[e-lang] Bug (0.8.35f): Scope oddities in ObjectExpr with
'extends'; Kernel-E change proposal
Mark S. Miller
markm at cs.jhu.edu
Sat Mar 11 21:41:58 EST 2006
Kevin Reid wrote:
> ? e`def a extends (def b := 1) {}`.staticScope()
> # value: <[] := ["E"] =~ ["a"] + var []>
>
> 'b' is not visible outside.
That's what I'd intended.
> ? e`def a implements (def b := 1) {}`.staticScope()
> # value: <[] := [] =~ ["b", "a"] + var []>
>
> 'b' is visible outside.
That's a bug. Curiously, in E-on-Java, the bug is only in the calculation of
the staticScope. Actual execution hides b:
? def a implements (def b { to audit(_,_) :any { return true }}) {}
# value: <a>
? b
# problem: Failed: Undefined variable: b
> I think this could be fixed by a minor contortion of the ObjectExpr
> expansion:
It can't be fixed by expansion, since Kernel-E must be a subset of E. Except
for the awful Hilbert hotel renaming issue, a Kernel-E expression expanded by
the E-to-Kernel-E expansion should expand to itself.
The semantics of a Kernel-E ObjectExpr should be that it exports no
definitions into the surrounding scope. The calculation of staticScope should
be fixed to reflect that.
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
More information about the e-lang
mailing list