[module] dynaimic namespace/scope

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: [module] dynaimic namespace/scope

Brendan Eich-3
Brian Di Palma wrote:
>> That would require a tedious preamble for pretty much any bit of code you
>> >  want to write.
>> >
>
> You can add an exemption for any code/classes/functions in "@std" modules.
>
> Beyond those cases I see no issue.

Object detection is a (if not *the*) successful anti-versioning pattern
in JS on the web. It typically depends on global properties that may or
may not be present, accessed in the detection condition via window.foo
or typeof foo but then bound in the not-detected consequent, and used
later, without any object-property base-expression (dot) qualification.

Object detection ought to be usable in a module, and IIRC this is
another consideration informing the current design.

/be
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: [module] dynaimic namespace/scope

Brian Di Palma
Excellent point. I had forgotten all about polyfills.

You could work around that issue by allowing augmentation of the
"@std" module in some manner...in essence that's what a polyfill does.
Your polyfill code would be loaded up first, it would augment the
standard module and then your application code would execute with no
issues.

This would mean the standard module is not consistent with other
modules so it's not a proposal I'm putting too much weight on.


On Thu, Jul 11, 2013 at 6:26 PM, Brendan Eich <[hidden email]> wrote:

> Brian Di Palma wrote:
>>>
>>> That would require a tedious preamble for pretty much any bit of code you
>>> >  want to write.
>>> >
>>
>>
>> You can add an exemption for any code/classes/functions in "@std" modules.
>>
>> Beyond those cases I see no issue.
>
>
> Object detection is a (if not *the*) successful anti-versioning pattern in
> JS on the web. It typically depends on global properties that may or may not
> be present, accessed in the detection condition via window.foo or typeof foo
> but then bound in the not-detected consequent, and used later, without any
> object-property base-expression (dot) qualification.
>
> Object detection ought to be usable in a module, and IIRC this is another
> consideration informing the current design.
>
> /be
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
12