Let's face it - concurrency is hard. Deadlocks, race conditions - these make your head hurt quite often, and trying to debug those issues only adds up more pain. Why don't we try to avoid those and still have our programs run concurrently? But can we do that? YES! Meet Pony. Pony is an object-oriented, capabilities-secure programming language with an actor model implementation at its core - here "actor" is a keyword! Pony is fun because it fixes most issues of concurrent programming. In the world of Pony it's the compiler that tells you whether your program is safe to execute. It's also type-safe, has no runtime exceptions and you can even use lambdas! I'll show you some examples of Pony programs, how its type system works and how capabilities render your concurrency safe.
11. MEET PONY
Pony is an open-source, object-oriented,
actor-model, capabilities-secure, high
performance programming language.
young (0.9.0 released on 11.11)
12. WHAT IS PONY?
object oriented
actor model
type-safe
no runtime exceptions
no locks
13. PONY LANGUAGE FEATURES
classes, actors, primitives
nominal and structural subtyping
object literals and lambdas
generics
pattern matching
C FFI
per actor, concurrent garbage collection
14. PONY IS STATICALLY TYPED
it can understand code
type system makes guarantees
enforces concurrency patterns
high performance (llvm)
15. PONY IS AN ACTOR MODEL
uses actors to run asynchronous code
passes messages, triggers behaviors
causal message ordering
actors are sequential themselves
16. CAPABILITIES
A capability is an unforgeable token that
(a) designates an object and (b) gives the
program the authority to perform a specific
set of actions on that object.
18. REFERENCE CAPABILITIES
Cap Description
ref reference Normal data
val value Immutable data
box box Read-only to you
iso isolated Isolated data
trn transition Write-only to you
tag tag Identification only
19. REFERENCE - REF
no other variable can be used by other
actors to read from or write to that object.
21. TRANSITION - TRN
no other variable can be used by any actor
to write to that object, and no other
variable can be used by other actors to
read from or write to that object
22. VALUE - VAL
no other variable can be used by any actor
to write to that object.
23. ISOLATED STATE - ISO
no other variable can be used by any actor
to read from or write to that object
27. CAPABILITY ALIASING
more than one variable pointing to the same object
iso > tag
trn > box
everything else as itself
ephemereal types (iso^)
alias types (iso!)
28. SUBTYPING
sometimes we need to supply other types
we need to make sure we can do that safely
simple substitution
aliased and ephemeral substitution