
Pony: Lock-less, data-race-free concurrency - whynotwhynot
https://tutorial.ponylang.io/
======
whynotwhynot
" \- It’s type safe. Really type safe. There’s a mathematical proof and
everything.

\- It’s memory safe. Ok, this comes with type safe, but it’s still
interesting. There are no dangling pointers, no buffer overruns, heck, the
language doesn’t even have the concept of null!

\- It’s exception safe. There are no runtime exceptions. All exceptions have
defined semantics, and they are always handled.

\- It’s data-race free. Pony doesn’t have locks or atomic operations or
anything like that. Instead, the type system ensures at compile time that your
concurrent program can never have data races. So you can write highly
concurrent code and never get it wrong.

\- It’s deadlock free. This one is easy, because Pony has no locks at all! So
they definitely don’t deadlock, because they don’t exist.

"

"By sharing only immutable data and exchanging only isolated data we can have
safe concurrent programs without locks. The problem is that it’s very
difficult to do that correctly. If you accidentally hang on to a reference to
some isolated data you’ve handed over or change something you’ve shared as
immutable then everything goes wrong. What you need is for the compiler to
force you to live up to your promises. Pony reference capabilities allow the
compiler to do just that."

"Reference capabilities allow you to label different bits of data based on how
that data can be shared. The Pony compiler will then verify that you are in
fact correctly using the data based on the labels you provide. Reference
capabilities combined with Pony’s actor model of concurrency makes for a
powerful pairing."

[https://www.ponylang.io/discover/](https://www.ponylang.io/discover/)

