Live data from Hacker News

Introduction to the Pony programming language

opensource.com

1–10 of 77 posts

Re: Introduction to the Pony programming language

#3

Hi all, In addition to being the submitter, I'm also the author and a member of the Pony core team. I'll check the comments here from time to time and answer what I can.

Hi spooneybarger. I'm curious: why is 1/0 == 0? Is it because there is no way to panic/kill the current actor with an error?

Re: Introduction to the Pony programming language

#4
post #3

Hi all, In addition to being the submitter, I'm also the author and a member of the Pony core team. I'll check the comments here from time to time and answer what I can.

Hi spooneybarger. I'm curious: why is 1/0 == 0? Is it because there is no way to panic/kill the current actor with an error?

That's covered in the Pony tutorial.

https://tutorial.ponylang.org/gotchas/divide-by-zero.html

I can elaborate a bit on what is in the tutorial. With the current semantics, you as the application programmer can check for division by zero and throw `error` if you want. Otherwise, every division operation would be partial which given that pony forces you to handle all partial functions, can get to be very painful.

We are working on adding value dependent types and will be revisiting the divide by 0 question. Some work was done on that for a thesis a couple years back but hasn't been integrated into Pony by the author as they have had time constraints since leaving school. You can check out a video about the work here: https://vimeo.com/175746403

It's definitely something that folks bring up. We aren't thrilled with the current functionality but feel its better than the previous functionality and are looking to slow improve the situation over time.

It can definitely bite the uninitiated if they aren't careful.

Re: Introduction to the Pony programming language

#7
>"A programming language is just another tool. It's not about syntax. It's not about expressiveness. It's not about paradigms or models. It's about managing hard problems." —Sylvan Clebsch, creator of Pony

Well, isn't that a zero content statement?

Sure, if you can't help in managing problems (and hard problems) the language is not that good.

But I'd argue a language succeeds or fails in helping you manage problems through its syntax, expressiveness, paradigms, models, and other attributes (like community size, lib ecosystem, tooling, speed, etc).

Re: Introduction to the Pony programming language

#8

> Pony's reference capabilities and Rust's borrow checker both provide data safety; they just approach it in different ways and have different tradeoffs. Would like to see a summary of what those tradeoffs are. Very curious!

This won't be an exhaustive answer, but I can asnwer a little. Also note, this is purely based on my own experiences with Rust (and Pony) and from what I've heard from other folks as well.

Both are difficult for folks just learn the languages to grasp. When I tried doing async programming in Rust, I found the borrow checker especially hard to deal with. Pony's reference capabilities, once you understand them, apply quite naturally to async code. This is important as most actions in Pony involve sending asynchronous messages between actors. There are certain patterns of passing around isolated regions of memory that are a pain in the ass to do in Pony that are very easy to do in Rust (once you know how to work with the borrow checker). It's something we are aware of on the Pony and are working to address.

Reference capabilities are part of the type of variables. This can make writing your own generics really hard unto you have a really good grasp of the type system and reference capabilities. It's the steepest learning curve in all of Pony.

Reference capabilities exist only at compile time but, something about how people think about them leads people to wanting to be able to match on them at runtime. I suspect this is something about how we teach them. It's a bit of a hurdle for some folks and can lead to some confusion early on.

Someone who has spent more time writing Rust and helping people learn Rust could come up with a similiar list. From time to time, Steve Klabnik and I have talked about similiarities in how problems folks have in learning the two languages.

I prefer reference capabilities to the borrow checker because reference capabilities more closely align with how I think about data safety.

Re: Introduction to the Pony programming language

#9

Hi all, In addition to being the submitter, I'm also the author and a member of the Pony core team. I'll check the comments here from time to time and answer what I can.

I understand that its actor model pursues very different ideas from Erlang and is therefore very limited and bare bones, basically allowing only per actor event handlers (behaviors in Pony terms). How does it work in practice, do you use higher order functions to construct basic flows? Like doing something, then entering receive loop for certain messages and making sure no other handler gets called to mess with the state until we are in receive loop for this type of message, then doing something else and entering another receive loop and so on.
Post reply on HN