Remarks about module import

Mark S. Miller erights at google.com
Tue Aug 19 06:47:54 PDT 2008


On Tue, Aug 19, 2008 at 1:00 AM, Ingvar von Schoultz
<ingvar-v-s at comhem.se> wrote:
>  From the descriptions it looks like this could instead use
> a syntax based on destructuring assignment, if es-harmony
> will have destructuring:

I expect es-harmony to have destructuring bind.



>     var {toggle: t, set: s} = import
>     (   fetchModule ('http://foo.com/someModule.js'),
>         {document: doc, background: bg}
>     );
>     t();
>
> One advantage would be that people would remember this syntax
> easily, since it's useful elsewhere.
>
> As a side effect, one could then choose to use the returned
> object instead:
>
>     var m = import
>     (   fetchModule ('http://foo.com/someModule.js'),
>         {document: doc, background: bg}
>     );
>     m.toggle();


Good suggestions! I like it.


-- 
 Cheers,
 --MarkM


More information about the Es-discuss mailing list