I hope we can still have "global" in Harmony. It is ugly to have to do:
const global = this;
and rely on that no one moves that code into a closure with a different "this".
Dave, I really like the lexical scope proposal. However, I do find
the sections regarding the global a bit confusing. Are the following
assumptions correct?
this.print = function(s) { ... };
{
use lexical scope;
this.print('OK');
print('FAIL');
}
--
erik
On Thu, Aug 28, 2008 at 06:22, P T Withington <[EMAIL PROTECTED]> wrote:
> On 2008-08-28, at 09:09EDT, Dave Herman wrote:
>
>> As for free references, what can you do with a free variable? If you
>> mean you want a way to look something up in the global object, then
>> use `this.id' or `this[expr]' (or `let global = this' followed by
>> global.id/global[expr]).
>>
>> It might be nice to have a standard library (called `global' or
>> something) that's bound to the global object so you can have a less
>> fragile binding to the global object than `this'.
>
> Exactly. I think it would be worthwhile to have a standard way to
> refer to the global object.
> _______________________________________________
> Es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss