ES5 strict mode disallow Function declaration in any statements. It's
fine, but Function declaration in top labelled statements seems
harmless, why not relax the rules to allow them so we can use "Labeled
Modules Specification" ? Though it seems too late to fix.
Code example:
'use strict' // cause SyntaxError: In strict mode code, functions can
only be declared at top level or immediately within another function.
exports: function area(x1, y1, x2, y2){
return length(x1, x2) * length(y1, y2);
}
References:
Labeled Modules Specification:
https://github.com/labeledmodules/labeled-modules-spec
LMS implementation: https://npmjs.org/package/linkjs
my.js (ES6-like module system which utilize the same ideas from LMS
for import/export syntax): http://github.com/hax/my.js
--
hax
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss