[e-lang] inconsistencies with __return ejector

Mark Miller erights at gmail.com
Sun Mar 23 15:11:17 EDT 2008


On Sun, Mar 23, 2008 at 8:23 AM, Toby Murray
<toby.murray at comlab.ox.ac.uk> wrote:
> Hi e-lang,
>
>  I'm writing to bring up the issue of the __return ejector and some
>  potential inconsistencies that surround it.
>
>  The essential potential problem is that most new programmers to E will
>  treat "return" as a statement and thus expect to be able to use it
>  pervasively.
>
>  I have been tripped up by the following
>
>  match [verb, args] {
>    return E.call(target, verb, args)
>  }
>
>  which is erroneous since the "__return" ejector is not defined here.


It has been discussed before, rather endlessly if I recall. For each
construct that one might think would bind __return, we need to decide
whether it does or not. No matter what we decide, programmers will
often expect the other and get tripped up.

You have identified the two most problematic: match clauses and when.

* On match clauses, I also often trip up in the way you describe, even
though I defined the behavior. Also, the problem's worse than you
describe. In the code:


def foo() {
    def bar {
        match [verb, args] {
            ...
            return ...
    }
    def x := bar.msg(1,2)
}

the return inside the match clause returns from foo(). x never gets
assigned a value.


* when clauses used to operate the way this page editor expected.
Again, either way will violate expectations, because expectations cut
both ways. However, the block on the right side of a when is thought
of more like a control structure block than like a normal object.

In order to enable control structures to be written in the language
(the Smalltalk-like "lambda-args" sugar), control-structure-like
blocks cannot implicitly rebind __return. We wish to take "when" out
of the E language grammer, making "when" no longer be a keyword, and
to redefine it using lambda-args. This would help ensure that other
eventual control abstractions can be written in the language as well.


-- 
Text by me above is hereby placed in the public domain

 Cheers,
 --MarkM


More information about the e-lang mailing list