ES4 draft: the global object
lhansen at adobe.com
Tue Mar 25 09:42:19 PDT 2008
> -----Original Message-----
> From: zeppieri at gmail.com [mailto:zeppieri at gmail.com] On
> Behalf Of Jon Zeppieri
> Sent: 25. mars 2008 06:47
> To: Lars Hansen
> Cc: es4-discuss at mozilla.org
> Subject: Re: ES4 draft: the global object
> 2008/3/24 Lars Hansen <lhansen at adobe.com>:
> > I would in particular like comments on eval.
> Why does the operator form of eval have the name
> 'intrinsic::eval' (in addition to plain 'eval')? Either eval
> has the distinction of being the only namespaced operator in
> the language, or else this is a pun.
> Either way, I don't see the justification. Backwards
> compatibility can't be the issue, since ES3 doesn't have namespaces.
It's a usability argument.
At the moment there are two global bindings for eval: the name we can
write as null::eval (eval in no namespace, ie, the same name ES3
programs know it by) and intrinsic::eval. These two programs always
mean the same thing [*]:
use namespace intrinsic;
However it seems to me -- and I'm sure this is what we should be
discussion -- that the latter use of eval is most likely intended
to be the same as this program:
But then the first program also means the same thing as the third
Note also that
is the same as
so arguments about 'namespaced operators' are probably not right.
IMO the operator form of eval should be outlawed in all ES4 code (ie,
it should be more restrictive than what's currently written up) but
that's a discussion for another thread, maybe.
[*] User code can't introduce 'intrinsic' bindings except as overrides.
There is no predefined method called 'eval' except the global function.
Ergo the only code that can shadow 'eval' uses 'with (g) ' where g is
a global object. But then the two programs still mean the same thing,
More information about the Es4-discuss