Jesse McCarthy (2015-02-18T22:32:22.000Z)
Got it, thanks Rick.

----- Original Message ----- 
From: "Rick Waldron" <waldron.rick at gmail.com>
To: "Jesse McCarthy" <es-discuss-2015-02 at jessemccarthy.net>; "caridy" 
<caridy at gmail.com>
Cc: <es-discuss at mozilla.org>
Sent: Wednesday, February 18, 2015 5:05 PM
Subject: Re: Why is "export default var a = 1;" invalid syntax?


> On Wed Feb 18 2015 at 4:40:34 PM Jesse McCarthy <
> es-discuss-2015-02 at jessemccarthy.net> wrote:
>
>> > Jesse, you can do:
>> > `export default class Foo extends Backbone {}`
>>
>> Ok, thanks. The empty block is required?
>
>
> Yes, just like:
>
>  function Foo() {}
>
> Where the braces are the syntactic boundary around the FunctionBody; the
> braces here:
>
> class Foo {}
>
> ...Are the syntactic boundary around the ClassBody. ClassBody has
> "optional" (present or not) semantics, defined at
> https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-classdefinitionevaluation
> Steps 8 & 9
>
> Rick
>
>
>
>
>> The part after `extends` is just an
>> expression that evaluates to a function, right? So I could do this right
>> (where Backbone.Model.extend() returns a function)?:
>>
>> export default class Klass extends Backbone.Model.extend() {}
>> Klass.prototype.whatever = whatever;
>>
>> Thanks,
>> Jesse
>>
>> ----- Original Message -----
>> From: "caridy" <caridy at gmail.com>
>> To: "Jesse McCarthy" <es-discuss-2015-02 at jessemccarthy.net>
>> Cc: <es-discuss at mozilla.org>
>> Sent: Tuesday, February 17, 2015 5:38 PM
>> Subject: Re: Why is "export default var a = 1;" invalid syntax?
>>
>>
>> Jesse, you can do:
>>
>> `export default class Foo extends Backbone {}`
>>
>> in case you want to reference to the exported class in the body of the
>> module, or you can do:
>>
>> `export default class extends Backbone {}`
>>
>> /caridy
>>
>> > On Feb 17, 2015, at 4:47 PM, Jesse McCarthy
>> > <es-discuss-2015-02 at jessemccarthy.net> wrote:
>> >
>> > Re:
>> > https://esdiscuss.org/topic/why-is-export-default-var-a-1-invalid-syntax
>> >
>> > I find myself wanting to do this kind of thing with a function returned
>> > from a function, e.g. when using Backbone, and it seems silly that I
>> > can't:
>> >
>> > export default var Klass = Backbone.Model.extend();
>> > Klass.prototype.whatever = whatever;
>> > // ...
>> >
>> > For that use case will the following be functionally identical? Any
>> > gotchas with circular dependencies or anything?
>> >
>> > A)
>> > var Klass = Backbone.Model.extend();
>> > Klass.prototype.whatever = whatever;
>> > export default Klass;
>> >
>> > B)
>> > var Klass = Backbone.Model.extend();
>> > Klass.prototype.whatever = whatever;
>> > export { Klass as default };
>> >
>> > C)
>> > var Klass = Backbone.Model.extend();
>> > export default Klass;
>> > Klass.prototype.whatever = whatever;
>> >
>> > D)
>> > var Klass = Backbone.Model.extend();
>> > export { Klass as default };
>> > Klass.prototype.whatever = whatever;
>> >
>> > If I was willing to use class syntax could I do this?
>> >
>> > export default class Klass extends Backbone.Model.extend();
>> > Klass.prototype.whatever = whatever;
>> >
>> >
>> > Glen Huang said:
>> >> I think this is illegal, should be {a: a}
>> >
>> > Sorry, I'm probably missing something obvious, but what is this 
>> > referring
>> > to?
>> >
>> > _______________________________________________
>> > es-discuss mailing list
>> > es-discuss at mozilla.org
>> > https://mail.mozilla.org/listinfo/es-discuss
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
d at domenic.me (2015-02-22T03:27:38.436Z)
Got it, thanks Rick.