5 ms·
> 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
by hellofunk 8y ago
> 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!
- spooneybarger 8y agoThis 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.
- hellofunk 8y agoSounds very interesting. Very much like to see other languages starting to take this stuff seriously. Do you know where Pony is used in industry?
- spooneybarger 8y agoThere's a company in the UK that does consulting work for the NHS that recently announced in the Pony IRC that they were looking to hire. You'd have to check the IRC logs to find the name (search is by day so it could take a while): https://irclog.whitequark.org/ponylang/2018-04-30 https://irclog.whitequark.org/ponylang/2018-04-30 An early version of the Pony runtime is in use at one of the large banks in the UK. There's a couple other uses that I've heard of that I'm not at liberty to talk about. Publicly, Wallaroo Labs (where I work) is the only company talking about their usage. It's still early days for Pony. Pre-1.0 and all that. Plenty of improvements that we want to make to the language, the standard library and ecosystem before it makes it to 1.0.
- steveklabnik 8y agoBeing the dual of Sean, I know Rust super well, but don't have as much experience with Pony, especially newer versions. This basically corresponds to my understanding as well. I also say "Pony is like Rust with Erlang" too. I'd like to do a comprehensive comparison someday, but just don't have the time...
- spooneybarger 8y agoSame (on the just dont have the time).
- sargun 8y agoSo, as someone who has only dabbled in Pony, and Rust, I'll try to give an answer. With Rust, you have to fight the borrow checker, and either work out lifetimes manually, or just copy stuff around 'by hand' -- In reality, the whole set of traits to automagically copy stuff around doesn't work. In addition, the mental overhead of Cells, mutable cells, Rcs, and ARCs, is a lot. Pony normally works out of the box, because quite a bit can just be passed by value. You can pass by reference using reference capabilities, but there's a lot less cognitive overhead there, and a lot less fighting the compiler. I think, in the future, Pony could even derive the capabilities required automagically in many cases. I'd say the biggest issue is less around safety, but around the I/O, and FFI models.
- dbaupp 8y agoI think one of the core differences that informs a lot of the other trade-offs is Rust has minimal runtime (e.g. no garbage collector, works in bare metal environments), whereas Pony (I think) is willing to have a heavier-weight runtime with garbage collection.