IIAFEs?

Petter Envall petter.envall at gmail.com
Sat Jun 1 21:10:39 PDT 2013


2013/6/2 David Bruant <bruant.d at gmail.com>

> Le 01/06/2013 16:52, Jorge a écrit :
>
>  On 02/06/2013, at 01:22, Brandon Benvie wrote:
>>
>>> On 6/1/2013 3:44 PM, Jorge wrote:
>>>
>>>> But they're not fully interchangeable, for example I can exit a
>>>> function at any point with a return, but can I exit a block at any point
>>>> with a break or something?
>>>>
>>>     block: {
>>>       if (true) {
>>>         break block;
>>>       }
>>>     }
>>>
>> What might happen with this is that if you concatenate a bunch of .js
>> files that use this pattern, they might end redefining the same label
>> (which would be an error, I guess). Wrapping it all in another block would
>> solve that?
>>
>> {
>>    block: {
>>      if (true) {
>>        break block;
>>      }
>>    }
>> }
>>
>> But then... I'm not sure this is any better than an IIFE!
>>
> You can also use a less naive concatenator. Labels seem to be very static
> parts of a JS program. It sounds doable to find and rewrite them.
>
> Given what people have been doing with esprima recently [1], I have the
> impression it would be even easy (?)
>

David
>
> [1] https://github.com/olov/defs
>
>

Ouch?

It seems like a sorry path to take that makes one have to comfess "Yes. In
this language we have made some improvements that make it unsafe to
concatenate program files like before - without using a parser/rewriter".
Or is there another way?

Otherwise it seems tom me like IIFEs still would do the best job defining
"modules" (in the sense "parts of a program") in the outermost scope.

// P







> ______________________________**_________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130602/b59f748c/attachment.html>


More information about the es-discuss mailing list