breuleux / earl-grey

Programming language compiling to JavaScript
http://breuleux.github.io/earl-grey/
MIT License
464 stars 6 forks source link

Consider opt-in to strong mode #18

Open davej opened 9 years ago

davej commented 9 years ago

Strong mode is supported in the new iojs and EG seems to do a lot of the optimisations by default anyway so it would be nice to be able to opt-in (or perhaps make it the default)?

breuleux commented 9 years ago

Ah, yeah, that would be cool! I would have to make some adjustments, though. Since originally I compiled to ES5, optional and rest arguments in EG functions do not compile to ES6 optional/rest arguments, but use arguments instead (this would be a good thing to fix). Also, some object declarations (not the simple ones) build an empty object and then accumulate properties on it (which I think strong mode disallows?) I will keep this in mind, still.

davej commented 9 years ago

Discussed in gitter but repeating here for posterity.

Strong mode does allow a long-handed way to dynamically add properties:

Object.defineProperty(obj, 'a', { value: 'This property was added dynamically!' });