Re: Idiomatic representation of { buffer, bytesRead }

2015-03-05 Thread Kevin Smith
source.next(myDataView) - PromiseDataView Derp. Should have been: source.next(dataView) - PromiseIteratorResultDataView which you kind of need anyway ; ) ___ es-discuss mailing list es-discuss@mozilla.org

Re: Idiomatic representation of { buffer, bytesRead }

2015-03-05 Thread Bergi
Kevin Smith schrieb: Should have been: source.next(dataView) - PromiseIteratorResultDataView which you kind of need anyway ; ) Wouldn't `.next()` rather need to return an IteratorResultPromiseDataView? Bergi ___ es-discuss mailing list

Re: Idiomatic representation of { buffer, bytesRead }

2015-03-05 Thread Kevin Smith
Wouldn't `.next()` rather need to return an IteratorResultPromise DataView? No, because the done-ness of the iteration is itself asynchronous. You don't know whether you're done iterating until the promise resolves. https://github.com/zenparsing/async-iteration/

RE: Idiomatic representation of { buffer, bytesRead }

2015-03-05 Thread Domenic Denicola
From: Jason Orendorff [mailto:jason.orendo...@gmail.com] Would it make it seem less strange if you specified the argument as a dictionary with these properties: {buffer:, byteOffset:, byteLength:, constructor:} ...and then casually mention that DataViews and TypedArrays both happen

Re: Idiomatic representation of { buffer, bytesRead }

2015-03-05 Thread Bergi
Kevin Smith schrieb: Wouldn't `.next()` rather need to return an IteratorResultPromise DataView? No, because the done-ness of the iteration is itself asynchronous. You don't know whether you're done iterating until the promise resolves. https://github.com/zenparsing/async-iteration/ Oh,

Re: Class double-bind

2015-03-05 Thread Brendan Eich
Luke Scott wrote: Currently you can do this anyway: const C = class {}; if (someCondition) { C = class OtherC {}; } You can't: const is assign-once in ES6, and only from the initialiser in the declaration. /be ___ es-discuss mailing list

Re: How to fix the `class` keyword (Brendan Eich)

2015-03-05 Thread Eric Elliott
In case it helps, the idea mooted for ES7 is that you'd add a call handler to the class for when it is invoked without `new`: class Point2D { constructor(x, y) { this.x = x, this.y = y; } [Symbol.call](x, y) { return new this.constructor(x, y); } ... } I used

Re: How to fix the `class` keyword (Brendan Eich)

2015-03-05 Thread Brendan Eich
Eric Elliott wrote: Thanks Brendan. This is very helpful indeed! Where can I learn more about that solution? I know of this gist: https://gist.github.com/wycats/0bd8f14066e44ed7b90e. Cc'ing wycats. I assume for backwards compatibility, this will not be default behavior, so we're going to

Re: Class double-bind

2015-03-05 Thread Boris Zbarsky
On 3/5/15 11:13 AM, Allen Wirfs-Brock wrote: Editorially it would be a trivial change to make class declaration produce immutable bindings. Just to be clear, this would make class declarations behave differently from builtins, both the ES kind and the IDL kind, right? I'm not saying that's

RE: Class double-bind

2015-03-05 Thread Domenic Denicola
From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Boris Zbarsky Just to be clear, this would make class declarations behave differently from builtins, both the ES kind and the IDL kind, right? I think that would be true if your mental model of built-ins is that, in the

Re: Idiomatic representation of { buffer, bytesRead }

2015-03-05 Thread Kevin Smith
But you can support both, like this: pull(DataView) - PromiseDataView pull(TypedArrayView) - PromiseTypedArrayView of the same type A view argument conveniently provides just the three pieces of information you need, plus a type. I thought of that. However, I found it a

Re: Class double-bind

2015-03-05 Thread Kevin Smith
Just to be clear, this would make class declarations behave differently from builtins, both the ES kind and the IDL kind, right? I'm not saying that's a problem necessarily, but worth keeping in mind. Good point. I think that we need to be looking ahead toward const class, and leave ES6

Re: Class double-bind

2015-03-05 Thread Allen Wirfs-Brock
On Mar 5, 2015, at 8:50 AM, Domenic Denicola wrote: From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Boris Zbarsky Just to be clear, this would make class declarations behave differently from builtins, both the ES kind and the IDL kind, right? I think that would

Re: Class double-bind

2015-03-05 Thread Kevin Smith
However, the double-binding issue makes this weirder. If non-const-class declarations were like non-const-function declarations, where there is only one binding per defining occurrence, then I would fully agree. But this issue of one defining occurrence creating two bindings that can diverge

Re: Class double-bind

2015-03-05 Thread Andreas Rossberg
On 5 March 2015 at 04:57, Brendan Eich bren...@mozilla.org wrote: Allen Wirfs-Brock wrote: This is novel weirdness. In C++/Java/C# etc. you don't see it because the corresponding declarations create immutable bindings. I agree that it would have been nice of we could have done that.

Re: Class double-bind

2015-03-05 Thread Mark Miller
Hi Kevin, If it were just a question of non-const-classes being too mutable, well, they're everywhere already ridiculously too mutable in line with most things in JS. It would be coherent to wait for const classes to repair the mutability of the binding at the same time it repairs the mutability

Re: Class double-bind

2015-03-05 Thread Allen Wirfs-Brock
On Mar 5, 2015, at 2:52 AM, Erik Arvidsson wrote: Traceur does not give any history on this but I also remember having this discussion in a f2f meeting. It was all about js has always been mutable, lets not change that. If you want immutability you have it with `const f = class {}`. I

Re: Class double-bind

2015-03-05 Thread Brendan Eich
Erik Arvidsson wrote: Traceur does not give any history on this but I also remember having this discussion in a f2f meeting. It was all about js has always been mutable, lets not change that. If you want immutability you have it with `const f = class {}`. Yeah, that fits the groove laid down

Re: Class double-bind

2015-03-05 Thread Luke Scott
On Mar 5, 2015, at 9:20 AM, Kevin Smith zenpars...@gmail.com wrote: However, the double-binding issue makes this weirder. If non-const-class declarations were like non-const-function declarations, where there is only one binding per defining occurrence, then I would fully agree. But this

Re: Class double-bind

2015-03-05 Thread Rick Waldron
On Thu, Mar 5, 2015 at 1:40 PM Luke Scott l...@cywh.com wrote: On Mar 5, 2015, at 9:20 AM, Kevin Smith zenpars...@gmail.com wrote: However, the double-binding issue makes this weirder. If non-const-class declarations were like non-const-function declarations, where there is only one binding

Re: Class double-bind

2015-03-05 Thread Erik Arvidsson
Traceur does not give any history on this but I also remember having this discussion in a f2f meeting. It was all about js has always been mutable, lets not change that. If you want immutability you have it with `const f = class {}`. On Thu, Mar 5, 2015 at 9:51 AM Andreas Rossberg

Re: es-discuss Digest, Vol 97, Issue 31

2015-03-05 Thread Eric Elliott
5. Re: How to fix the `class` keyword (Allen Wirfs-Brock) One of those possible enhancement that has been talked about is to implicitly treat a [[Call]] of a class constructor as an implicit 'new', just like you are suggesting. Doesn't this need to be configurable, and Brendan Eich