Return of <<- (eg, "await" / coroutines)
Here I'm considering returning adding coroutines to Goblins. They'd work a bit differently than before, allowing composition in environments when called with $
but without being able to interfere with anyone lower on the stack, thereby blocking re-entrancy attacks.
Instead of suspending to the top of the turn, an actor using <<-
would suspend to the top of its own call and would return a promise.
In effect, the following code would be equivalent:
(define ((^alice bcom bob))
(displayln "before")
(define from-bob (<<- bob "hello"))
(displayln "after"))
(define ((^alice bcom bob))
(displayln "before")
(on (<- bob "hello")
(lambda (from-bob)
(displayln "after"))
#:promise? #t))
<<-
should be interpreted not only as await
but also as potentially "oh yeah I'm going so fast oh shiiiii" for the usual reasons: it's different than $
in that the world is likely to change on you.
The choice to return #:promise? #t
probably will DTRT by default with asynchronous stuff due to promise pipelining/chaining/etc, and it also provides a path out for doing something sensible with $
.