Skip to content

Instantly share code, notes, and snippets.

@patternspandemic
patternspandemic / iso_in_tuple.pony
Last active August 1, 2018 15:09
Pony: Passing isolates in tuples
"""
Sometimes it's useful to put an `iso` into a tuple. However, given iso's extreme
reference restrictions, it may not be clear as how to extract said isolate from
the tuple later on. The main thing to remember about any isolates in a tuple is
that there's no extracting them without completely breaking apart the tuple.
The reference to the containing tuple must be consumed, and therefor destroyed
so that the extracted iso is the only iso.
(Note: types are made explicit for clarity, but also provides the compiler our
intent of dealing with an iso, and not an alias (iso!). Doing this will often