[e-lang] How to deal with eventual sending with non-local returns

Rob Withers reefedjib at yahoo.com
Tue Nov 6 23:17:50 EST 2007


What does E do with this kind of expression:

escape __break :any {
def promise := bob <- foo(carol);
when (promise p) -> done() {
        __break.run(p)
    }
}

?

thanks,
Rob

----- Original Message ----- 
From: "Rob Withers" <reefedjib at yahoo.com>
To: "e-lang" <e-lang at mail.eros-os.org>
Sent: Friday, November 02, 2007 5:23 PM
Subject: [e-lang] How to deal with eventual sending with non-local returns


>I am trying to add eventual sending to Smalltalk.  The Smalltalk language
> allows for multiple returns from a context with non-local returns:
>
> foo: bar
>
>    bar ifTrue: [^ 1].
>    self snafu.
>    ^ 0
>
> If bar is eventual (I don't have syntax to do eventual sending, I make the
> reference eventual so all sends to it are eventually sent), we don't know 
> at
> the time of invocation whether the method will exit through the non-local
> return or through the return at the end of the method.
>
> How to best deal with this?
>
> My thought is that the context needs to become eventual, be sent as a 
> lambda
> to the bar promise, and the context return a promise.  The return will 
> check
> to see if there is a resolver on the context and #resolve: it with the
> appropriate return value.  The lambda needs to be all sequential code from
> the point where a message is sent to the promise that includes a block as 
> an
> argument to the end of the context.  So the lambda would be:
>
> f := [:barVow |
>    barVow ifTrue: [^1].
>    self snafu.
>    ^ 0]
>
> and we would send:
>    bar whenResolved: f.
>
> Would this work?
>
> thanks!
> Rob
>
> _______________________________________________
> e-lang mailing list
> e-lang at mail.eros-os.org
> http://www.eros-os.org/mailman/listinfo/e-lang
> 



More information about the e-lang mailing list