I WANT A PONY!
Object-oriented, capabilities-secure with actor model
ABOUT ME
Piotr Buda @ So wareMill
-http://github.com/pbuda http://www.So wareMill.com
Twitter: @piotrbuda
CONCURRENCY
Executing multiple tasks
Disjoint and overlapping
Parallel and/or scheduled
Executed in unknown order
WHY DO WE NEED IT?
Because code runs in parallel we can get:
efficiency
scalability
PROBLEMS
we don't know the order of execution
atomicity violation
order violation
deadlocks
HOW TO HANDLE BUGS?
synchronization
share nothing
immutable state
isolated state
SYNCHRONIZATION
govern access to shared resource
solves problems
can lead to no concurrency at all
SHARE NOTHING
perfectly concurrent
scales perfectly
limited use
IMMUTABLE STATE
data can't change
can share global state
can't migrate without copy
doesn't work when you need to change state
ISOLATED STATE
exclusive access to state
ony one task can change data
sharing over time
no concurrent access
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)
WHAT IS PONY?
object oriented
actor model
type-safe
no runtime exceptions
no locks
PONY LANGUAGE FEATURES
classes, actors, primitives
nominal and structural subtyping
object literals and lambdas
generics
pattern matching
C FFI
per actor, concurrent garbage collection
PONY IS STATICALLY TYPED
it can understand code
type system makes guarantees
enforces concurrency patterns
high performance (llvm)
PONY IS AN ACTOR MODEL
uses actors to run asynchronous code
passes messages, triggers behaviors
causal message ordering
actors are sequential themselves
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.
REFERENCE CAPABILITIES
express access rights to objects
type qualifiers
make concurrency safe
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
REFERENCE - REF
no other variable can be used by other
actors to read from or write to that object.
BOX
no other variable can be used by other
actors to write to that object
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
VALUE - VAL
no other variable can be used by any actor
to write to that object.
ISOLATED STATE - ISO
no other variable can be used by any actor
to read from or write to that object
TAG
makes no guarantees about other
variables at all
CONSUMING OBJECTS
consume variables
destructive read
RECOVERING CAPABILITIES
recovering li s reference capabilities of the result
iso, trn, ref can become any
val, box can become immutable or opaque
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!)
SUBTYPING
sometimes we need to supply other types
we need to make sure we can do that safely
simple substitution
aliased and ephemeral substitution
SUMMARY
we want concurrency but it's hard to do right
Pony can help with that
USEFUL LINKS
http://ponylang.org
http://www.doc.ic.ac.uk/teaching/distinguished-
projects/2013/s.blessing.pdf
http://pages.cs.wisc.edu/~remzi/OSTEP/threads-bugs.pdf
http://github.com/pbuda/iwantapony/buildstuff2016
QUESTIONS?
THANK YOU

I want a pony