Re: How to deal with eventual sending with non-local returns

"Rob Withers" <reefedjib-/[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <0FCC36E4E4E64C498FEF5F5E65017A76@Quotar>
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-/[email protected]>
To: "e-lang" <[email protected]>
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
> [email protected]
> http://www.eros-os.org/mailman/listinfo/e-lang
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.