On Saturday, 25 June 2016 at 12:01:25 UTC, rikki cattermole wrote:
2. You can hand out borrowed fiber-references to the fiber
heap when
calling non-fiber functions, but fiber-references can never be
turned
into non-fiber references.
This worries me.
1. This adds ref counting or some other form of restriction
which has not been declared as to what it is.
You can get quite far using modern type systems and static
analysis. You don't need to reference count, unless you export
the object outside the fiber. Or rather, the reference count is
only increased outside the fiber, if it is not reference outside
the fiber it stays at 0 (conceptually).
2. Removes the ability to assign to globals limiting usage.
You can add weak-references. Pin the object as being weakly
referenced. When the weak reference is accessed (using RAII), and
the object is alive, a weak-reference-counter is increased, when
the access is over (RAII goes out of scope) the
weak-reference-counter is decreased. If the object no longer
exists you get either null or an exception.