Duplicate super call behaviour

2015-10-24 Thread Sebastian McKenzie
I was recently reading the specification on the behaviour of duplicate super() calls in derived constructors. Reading the grammar the following is valid: ``` class Foo { constructor() { console.log("foobar); } } class Bar extends Foo { constructor() { super(); super(); } }

Re: Aliased object destructuring assignments?

2015-06-21 Thread Sebastian McKenzie
The syntax is indeed invalid, but syntax does exist to do the equivalent: ```javascript var { f: foo } = someObject; ``` On Mon, Jun 22, 2015 at 1:50 AM, Salehen Rahman salehen.rah...@gmail.com wrote: I know that `import` allows us to alias imports, like so: ```javascript import { f as

Re: Example of real world usage of function bind syntax

2015-06-11 Thread Sebastian McKenzie
In Babel all the experimental features are behind flags and the docs (http://babeljs.io/docs/usage/experimental/) are very explicit about their status: Subject to change These proposals are subject to change so use with extreme caution. Babel may update without warning in order to track

Re: Example of real world usage of function bind syntax

2015-06-11 Thread Sebastian McKenzie
Not really. It would require something like Recast (https://github.com/benjamn/recast) to do nondescructive pretty printing to retain as much of the source formatting as possible. This shouldn’t be necessary though as if you’re using these experimental features extensively enough in production

Re: Promise sub-class: super((resolve, reject) = this) ?

2015-06-02 Thread Sebastian McKenzie
This is a limitation of Babel and not at all a reflection of the actual specification. This restriction is imposed order to follow ES2015 semantics of not being able to reference `this` before `super()`. It does a pretty dumb check of only allowing it to be strictly after the call (ie. not

RE: Promise sub-class: super((resolve, reject) = this) ?

2015-06-02 Thread Sebastian McKenzie
Ah, completely right. At first glance I thought it was this similar but separate issue: ```js class Foo {   constructor(callback) {     this.callback = callback; // just storing it!   } } class Bar extends Foo {   constructor() {     super(() = this); // reference to `this` will

Re: Label statement moveable

2015-05-20 Thread Sebastian McKenzie
So you want to add goto to JavaScript? On Wed, May 20, 2015 at 11:42 AM, Emanuel Allen emanuelal...@hotmail.com wrote: Clarify: My previous post was not that clear. That post display what I would like to do in the language. Here is the actual code if I choose to do it as the language is

Re: Non-binding destructuring assignment

2015-04-29 Thread Sebastian McKenzie
The binding identifiers are optional. You can do what you want already with: const lastOfThree = ([,, third]) = {   return third; } On Wed, Apr 29, 2015 at 12:40 PM, Elie Rotenberg e...@rotenberg.io wrote: Using array destructuring assignment and constraining linting rules, I often find

Re: Trailing commas in arguments list, imports and destructuring

2015-04-22 Thread Sebastian McKenzie
Note that you’ve got the experimental REPL option enabled which means all transformers are enabled which includes the `es7.trailingFunctionCommas` one which allows trailing commas in function parameter lists and call expressions. The destructuring grammar does allow trailing commas

Re: super() on class that extends

2015-04-10 Thread Sebastian McKenzie
Babel is a terrible reference implementation for subclassing since it relies on the engine. See the docs http://babeljs.io/docs/usage/caveats/#classes and https://github.com/babel/babel/issues/1172 for more info. This exact question (super in derived class constructors) was also indirectly

Re: Existential Operator / Null Propagation Operator

2015-04-07 Thread Sebastian McKenzie
No, you’d just memoise it to a variable:   a?.d().f?.b to:   var _temp, _temp2;   (a != undefined ? (temp = a.d() != undefined ? (_temp2 = _temp.f != undefined ? _temp2.b : undefined) : undefined))); You’re going to need to memoise all member expressions anyway as they might be

Re: es-discuss Digest, Vol 95, Issue 45

2015-01-20 Thread Sebastian McKenzie
Reason for the verbose and quirky output in 6to5 is due to performance, see https://github.com/6to5/6to5/pull/203 On Tue, Jan 20, 2015 at 11:45 PM, Fabrício Matté ultco...@gmail.com wrote: Point 2 is incorrect (e.g. `new (Foo.bind.apply(Foo, [undefined].concat(args)))`). I stand corrected.

Re: Overriding the == operator, like in Java/Lua/Python/whatever.

2015-01-03 Thread Sebastian McKenzie
http://www.slideshare.net/BrendanEich/value-objects2 On Sun, Jan 4, 2015 at 1:08 PM, Caitlin Potter caitpotte...@gmail.com wrote: Unfortunately, there's no real way to do this as of yet, short of abusing ToPrimitive in certain cases, far from ideal. I'm sure someone must have proposed it at

Re: Standard modules?

2014-01-20 Thread Sebastian McKenzie
get away with adding that global. /be ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss -- Sebastian McKenzie ___ es-discuss mailing list es-discuss