Introduction to Pony, actor model, reference capabilities and making concurrent DirectX games with Pony.
Presented at MVP Fusion #3.
http://mvpfusion.azurewebsites.net/
6. Actors in Pony
• Similar to classes
• Can have asynchronous functions called behaviours
• Bodies of behaviours will execute at some indeterminate time in the
future
• All behaviours always return the receiver
They can't return something they calculate (since they haven't
run yet)
Returning the receiver is a convenience to allow chaining calls
on the receiver
7. Behaviours
actor Aardvark
let name: String
var _hunger_level: U64 = 0
new create(name': String) =>
name = name'
be eat(amount: U64) =>
_hunger_level = _hunger_level - amount.min(_hunger_level)
8. “Here we have an Aardvark that can eat asynchronously.
Clever Aardvark.”
12. Reference Capabilities
• ref – mutable
• val - immutable
• iso - no one else can read or write
… plus three more.
13. Reference Capabilities
actor FileStream is OutStream
let _file: File
new create(file: File iso) =>
_file = consume file
be write(data: ByteSeq) =>
_file.write(data)
18. References
• S. Clebsch, Pony: Co-Designing a Type System and a Runtime.
Microsoft Research, Cambridge, 2016.
• S. T Allen, S. Clebsch, S. Blessing, A. McNeil et al., Pony Tutorial.
http://tutorial.ponylang.org, 2016.
• S. Clebsch, S. Blessing, J. Franco, S. Drossopoulou, Ownership and
Reference Counting based Garbage Collection in the Actor World.
Causality Ltd. and Imperial College London, 2015.
• S. Clebsch, S. Drossopoulou, Fully Concurrent Garbage Collection of
Actors on Many-Core Machines. OOPSLA 2013.
• S. Clebsch, S. Drossopoulou, S. Blessing, A. McNeil, Deny Capabilities
for Safe, Fast Actors. Causality Ltd. and Imperial College London.
19. Thank you for listening!
https://github.com/npruehs
@npruehs
nick.pruehs@daedalic.com