I’m back…. but no pony.

It seems that I disappeared for a while… various reasons that I won’t go into.  I seem to be motivated again, thanks in part to pony.

Pony (www.ponylang.org) is a language which was the topic of a talk at linux.conf.au in January 2018.  It was interesting and it motivated me, so that it good.  But I don’t like pony.  Why?

One reason is that pony doesn’t distinguish between expressions and statements.  Any structured statement can be used as an expression if it provides a value.  I found I particularly disliked that when I was looking at Rust a while back for lwn.net, and I don’t see any reason to change my mind.  My current belief is that if you want statements where expressions are expected (and I sometimes do), then the language syntax should allow you to put statements there.  Ocean does that. Alternately, if you want a value to be determined by a construct complex enough to need a statement, then you should just use statements and assign a variable.

I don’t particularly mind the “c?a:b” construct in C, which is an if statement in the form of an expression, because it isn’t trying to be a statement.  The “a if c else b” in Python is possibly better, but either is definitely better than “if a then b else c end” which pony uses.  Different things should be different.

The other thing that bothered me about Pony is the concurrency model.  It uses an “actor” based model where actors can send messages to other actors, and receive messages in return.  I’m sure this is a very powerful model and has an important place, but I wouldn’t want it as the only model in a language.  Actors cannot wait for a reply; instead, they must tell their correspondent to send a message back when they are done.  This amounts to “callback-oriented programming“, as used in node.js, where all sequencing becomes callbacks.  I think callbacks have their place, but it isn’t everywhere.  There are times when I would want to be able to wait for a response.  As far as I can tell, pony doesn’t allow for those times.

The up side

Pony isn’t all bad of course.  It puts a lot of focus on type safely and proper management of references.  The approach — described as “reference capabilities” — seems a little bit different to that taken by Rust, and it would be well worth analysing the two side-by-side to see what lessons can be learned.

So while I’m not sold on using Pony, I may well learn from it.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


one × 6 =

ERROR: si-captcha.php plugin says GD image support not detected in PHP!

Contact your web host and ask them why GD image support is not enabled for PHP.

ERROR: si-captcha.php plugin says imagepng function not detected in PHP!

Contact your web host and ask them why imagepng function is not enabled for PHP.