
The Snake and the Horse: How Wallaroo's Python API Works with Pony - aturley
https://blog.wallaroolabs.com/2018/04/the-snake-and-the-horse-how-wallaroos-python-api-works-with-pony/
======
erokar
Pony is one of the new languages that intrigue me the most. Its performance
seems very good, but how would you compare its expressiveness to e.g. Python?

~~~
aturley
That's a tough one. Python's dynamic typing means that you can write concise
code as long as everything is of the correct type. But the consequence of this
is that it is easy to accidentally express the wrong thing and only find out
about it at runtime.

Pony's type system requires that you be a bit more explicit, but the tradeoff
is that you get better guarantees about the correctness of your program. As
your program grows in size these guarantees become more and more useful, or at
least that's what I've found.

One part about Pony that can seem like an impediment to expressiveness in Pony
is reference capabilities. Pony forces you to think about how objects can be
accessed from different actors, which can sometimes make it hard to do things
that seem like they would be simple, especially if you are new to the
language. The payoff for this is that once you get the reference capabilities
correct the compiler guarantees that your program will not have race
conditions. In some ways, I'd say that if you're writing multi-threaded code
then expressiveness that doesn't offer any safety guarantees is a false
economy, because you'll probably end up rewriting the "expressive" code many
times to get things right.

Python's a great language, and I don't mean to disparage it. I've used it
quite a bit in my career, and for certain types of problems it is still the
first tool that I reach for. In my mind, Pony excels in some areas where
Python is somewhat weak, so they can live comfortably together in your
programming toolbox.

~~~
erokar
Thanks for your answer.

> Pony forces you to think about how objects can be accessed from different
> actors, which can sometimes make it hard to do things that seem like they
> would be simple, especially if you are new to the language.

Can you write single-threaded code in Pony without doing this, or do you have
to do it regardless? The former would seem like a form of premature
optimization.

~~~
spooneybarger
Pony is an actor based language. You have to have at least one actor.
Effectively, the answer is no. You could write "single-threaded" Pony code but
it's not something you would do.

Pony is designed to make something hard- writing efficient, safe, concurrent
code- easy. Anything you make something that is hard easier, you are
invariably going to make some other things less easy, perhaps even difficult.

------
aturley
I'm the author of this blog post. If you have any questions, comments, or
feedback, please feel free to drop them in here.

