Good observation. However, if I were to simplify, I’d only keep #3. #1 and #2 look more syntactically questionable to me (kind of abusing names as keywords/markers).
Axel On 05 Dec 2013, at 15:18 , Kevin Smith <zenpars...@gmail.com> wrote: > TLDR: We should consider deferring specialized syntax for exporting a > "default" binding until after ES6. > > In the current draft, there are 3 ways to export a default binding: > > 1. Export a local binding with the name "default": > > class Parser { ... } > export { Parser as default }; > > 2. Use "default" as a BindingIdentifier. BindingIdentifer is parameterized > on [Default]: > > export class default { ... } > > 3. Use a "default" assignment: > > export default class { ... }; // AssignmentExpression > > Methods 2 and 3 are inessential - they can be expressed in terms of 1. > > Methods 2 and 3 are minor optimizations. Method 1 is by no means painful to > write or read. > > There are some potential downsides to providing methods 2 and 3: > > - It may be that they provide too many ways to do the same thing, with too > little to differentiate them. > - Method 2 makes the grammar more complex, for parsers and (more importantly) > users. > - Method 3, being an assignment, introduces initialization-order sensitivity > that otherwise might be avoidable. > - They bind orthogonal issues: On the one hand, the need to export a default > binding, and on the other, the need to reference a local binding with some > local name. > > Proposal: defer "default export" sugarings until ES7, when we can use data > gathered from experience with ES6 modules to guide syntax additions. > > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss