Re: has the syntax for proxies been finalized ?

2013-10-18 Thread Tom Van Cutsem
Proxy.create and Proxy.createFunction are deprecated. The correct syntax is `new Proxy(target, handler)` In my original direct proxies proposal, the `new` was optional, so that `var p = Proxy(target, handler)` works equally well (cf.

`String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Mathias Bynens
ES6 fixes `String.fromCharCode` by introducing `String.fromCodePoint`. Similarly, `String.prototype.charCodeAt` is fixed by `String.prototype.codePointAt`. Should there be a method that is like `String.prototype.charAt` except it deals with astral Unicode symbols wherever possible?

RE: has the syntax for proxies been finalized ?

2013-10-18 Thread Domenic Denicola
From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Angus Croll I couldn't find a commitment to a specific syntax in the latest ES6 standard  It's not quite fleshed out yet, but the constructor function is at least there:

Re: has the syntax for proxies been finalized ?

2013-10-18 Thread David Bruant
Le 18/10/2013 07:19, Angus Croll a écrit : I couldn't find a commitment to a specific syntax in the latest ES6 standard The latest official news is in the May 2013 TC39 notes: https://github.com/rwaldron/tc39-notes/blob/master/es6/2013-05/may-21.md#44-proxies The final design of proxies is the

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Rick Waldron
On Fri, Oct 18, 2013 at 8:46 AM, Mathias Bynens math...@qiwi.be wrote: ES6 fixes `String.fromCharCode` by introducing `String.fromCodePoint`. Similarly, `String.prototype.charCodeAt` is fixed by `String.prototype.codePointAt`. Should there be a method that is like `String.prototype.charAt`

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Mathias Bynens
On 18 Oct 2013, at 09:21, Rick Waldron waldron.r...@gmail.com wrote: I think the idea is good, but the name may be confusing with regard to Symbols (maybe not?) Yeah, I thought about that, but couldn’t figure out a better name. “Glyph” or “Grapheme” wouldn’t be accurate. Any suggestions?

Re: has the syntax for proxies been finalized ?

2013-10-18 Thread Angus Croll
Great info thanks (and Tom and Domenic) A note on MDN confirming that direct proxy adhered to the new spec (and a similar one on old proxy saying it didn't) would probably be immensely helpful to other people who had the same question I had. Also (to all) deleting or marking as obsolete all

RE: has the syntax for proxies been finalized ?

2013-10-18 Thread Domenic Denicola
From: es-discuss [es-discuss-boun...@mozilla.org] on behalf of Angus Croll [anguscr...@gmail.com Also (to all) deleting or marking as obsolete all wiki-harmony docs that no longer meet the standard would save a lot of wasted hours I know Rick has already made strides in that direction via

Re: has the syntax for proxies been finalized ?

2013-10-18 Thread Angus Croll
I can confirm: npm install harmony-reflect node --harmony require('harmony-reflect') and I'm good to go with ES6 proxy syntax thanks all! @angustweets On Fri, Oct 18, 2013 at 7:49 AM, Angus Croll anguscr...@gmail.com wrote: Great info thanks (and Tom and Domenic) A note on MDN

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Benjamin (Inglor) Gruenbaum
I also noticed the naming similarity to ES6 `Symbol`s. I've seen people fill `String.prototype.getFullChar` before and similarly things like `String.prototype.fromFullCharCode` for dealing with surrogates before. I like `String.prototype.signAt` but I haven't seen it used before. I'm eager to

Re: has the syntax for proxies been finalized ?

2013-10-18 Thread Rick Waldron
On Fri, Oct 18, 2013 at 10:53 AM, Domenic Denicola dome...@domenicdenicola.com wrote: From: es-discuss [es-discuss-boun...@mozilla.org] on behalf of Angus Croll [anguscr...@gmail.com Also (to all) deleting or marking as obsolete all wiki-harmony docs that no longer meet the standard would

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Mathias Bynens
Here’s my proposal. Feedback welcome, as well as suggestions for a better name (if any). ## String.prototype.symbolAt(pos) NOTE: Returns a single-element String containing the code point at element position `pos` in the String `value` resulting from converting the `this` object to a String.

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Rick Waldron
On Fri, Oct 18, 2013 at 10:47 AM, Mathias Bynens math...@qiwi.be wrote: On 18 Oct 2013, at 09:21, Rick Waldron waldron.r...@gmail.com wrote: I think the idea is good, but the name may be confusing with regard to Symbols (maybe not?) Yeah, I thought about that, but couldn’t figure out a

Re: has the syntax for proxies been finalized ?

2013-10-18 Thread Angus Croll
No worries guys - thanks for adding the 'obsolete' note @angustweets On Fri, Oct 18, 2013 at 8:13 AM, Rick Waldron waldron.r...@gmail.comwrote: On Fri, Oct 18, 2013 at 10:53 AM, Domenic Denicola dome...@domenicdenicola.com wrote: From: es-discuss [es-discuss-boun...@mozilla.org] on

[[Invoke]] and implicit method calls, once more

2013-10-18 Thread Jason Orendorff
I can't remember the conclusion of the earlier thread on this topic. The question was about how implicit method calls should interact with proxies in places (like [ToPrimitive](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive)) where the spec first checks that the desired

Re: has the syntax for proxies been finalized ?

2013-10-18 Thread Rick Waldron
On Fri, Oct 18, 2013 at 11:19 AM, Angus Croll anguscr...@gmail.com wrote: No worries guys - thanks for adding the 'obsolete' note Don't hesitate to ask for clarification on this list—especially if you think it will save you time :) Rick ___

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Rick Waldron
On Fri, Oct 18, 2013 at 11:15 AM, Mathias Bynens math...@qiwi.be wrote: Here’s my proposal. Feedback welcome, as well as suggestions for a better name (if any). ## String.prototype.symbolAt(pos) Here goes... String.prototype.elementAt? Rick ___

RE: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Domenic Denicola
Doesn't Unicode have some name for visual representation of a code point? Maybe it's symbol? ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Anne van Kesteren
On Fri, Oct 18, 2013 at 1:46 PM, Mathias Bynens math...@qiwi.be wrote: Similarly, `String.prototype.charCodeAt` is fixed by `String.prototype.codePointAt`. When you phrase it like that, I see another problem with codePointAt(). You can't just replace existing usage of charCodeAt() with

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Mathias Bynens
On 18 Oct 2013, at 10:48, Anne van Kesteren ann...@annevk.nl wrote: On Fri, Oct 18, 2013 at 1:46 PM, Mathias Bynens math...@qiwi.be wrote: Similarly, `String.prototype.charCodeAt` is fixed by `String.prototype.codePointAt`. When you phrase it like that, I see another problem with

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Rick Waldron
On Fri, Oct 18, 2013 at 11:53 AM, Mathias Bynens math...@qiwi.be wrote: On 18 Oct 2013, at 10:25, Rick Waldron waldron.r...@gmail.com wrote: String.prototype.elementAt? This may be confusing too, since the spec refers to `elements` as code units, not code points. Yes, slight mis-reading

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Anne van Kesteren
On Fri, Oct 18, 2013 at 4:58 PM, Mathias Bynens math...@qiwi.be wrote: On 18 Oct 2013, at 10:48, Anne van Kesteren ann...@annevk.nl wrote: When you phrase it like that, I see another problem with codePointAt(). You can't just replace existing usage of charCodeAt() with codePointAt() as that

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread André Bargull
/ I disagree. In those situations you should just iterate over the string using `for...of`. / That seems to iterate over code units as far as I can tell. for (var x of ?) print(x.charCodeAt(0)) invokes print() twice in Gecko. SpiderMonkey does not implement the (yet to be) spec'ed

Re: has the syntax for proxies been finalized ?

2013-10-18 Thread Angus Croll
Follow up question for Tom et al... Using require('harmony-reflect') var t = {a:3, c:4}; var p = Proxy( t, { get: function() {}, delete: function(t,x) { console.log('deleting'); delete t.a; } } ); delete p.c p; //{a:3} t; //{a:3} the console.log is not called

Re: has the syntax for proxies been finalized ?

2013-10-18 Thread André Bargull
Follow up question for Tom et al... Using require('harmony-reflect') var t = {a:3, c:4}; var p = Proxy( t, { get: function() {}, delete: function(t,x) { console.log('deleting'); delete t.a; } } ); delete p.c p; //{a:3} t; //{a:3} the console.log is not

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 7:21 AM, Rick Waldron wrote: On Fri, Oct 18, 2013 at 8:46 AM, Mathias Bynens math...@qiwi.be wrote: ES6 fixes `String.fromCharCode` by introducing `String.fromCodePoint`. Similarly, `String.prototype.charCodeAt` is fixed by `String.prototype.codePointAt`.

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 9:05 AM, Anne van Kesteren wrote: On Fri, Oct 18, 2013 at 4:58 PM, Mathias Bynens math...@qiwi.be wrote: On 18 Oct 2013, at 10:48, Anne van Kesteren ann...@annevk.nl wrote: When you phrase it like that, I see another problem with codePointAt(). You can't just replace

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Andrea Giammarchi
+1 for the simplified `at(symbolIndex)` I would expect '팆'.at(1) to fail same way 'a'.charAt(1) or 'a'.charCodeAt(1) would. I would expect '팆'.at(symbolIndex) to behave as `length` does based on unique symbol (unicode extra) so that everyone, except RAM and CPU, will have life easier with

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Andrea Giammarchi
the size of that unicode string is 1 ... meaning the **virtual** size for human eyes On Fri, Oct 18, 2013 at 10:06 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: +1 for the simplified `at(symbolIndex)` I would expect '팆'.at(1) to fail same way 'a'.charAt(1) or 'a'.charCodeAt(1)

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Andrea Giammarchi
if this is true then .at(symbolIndex) should be a no-brain ? ``` var virtualLength = 0; for (var x of ) { virtualLength++; } // equivalent of for(var i = 0; i virtualLength; i++) { .at(i); } ``` Am I missing something ? On Fri, Oct 18, 2013 at 10:03 AM, Allen Wirfs-Brock

Re: has the syntax for proxies been finalized ?

2013-10-18 Thread Angus Croll
thanks André that works! (I was going by https://github.com/tvcutsem/harmony-reflect/blob/master/doc/traps.md which says 'delete') @angustweets On Fri, Oct 18, 2013 at 9:38 AM, André Bargull andre.barg...@udo.eduwrote: Follow up question for Tom et al... Using

Re: has the syntax for proxies been finalized ?

2013-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 12:33 AM, Tom Van Cutsem wrote: Proxy.create and Proxy.createFunction are deprecated. The correct syntax is `new Proxy(target, handler)` In my original direct proxies proposal, the `new` was optional, so that `var p = Proxy(target, handler)` works equally well (cf.

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 10:06 AM, Andrea Giammarchi wrote: +1 for the simplified `at(symbolIndex)` I would expect '팆'.at(1) to fail same way 'a'.charAt(1) or 'a'.charCodeAt(1) would. They are comparable, as the 'a' example are index out of bounds errors. We only use code unit indices with

Re: [[Invoke]] and implicit method calls, once more

2013-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 8:24 AM, Jason Orendorff wrote: I can't remember the conclusion of the earlier thread on this topic. The question was about how implicit method calls should interact with proxies in places (like

Re: [[Invoke]] and implicit method calls, once more

2013-10-18 Thread Brandon Benvie
On 10/18/2013 11:01 AM, Allen Wirfs-Brock wrote: What your question does help me be more decisive on: We should not be in a rush to add an Invoke, InvokeFunction, or any new traps not needed for membranes, and not subject to a long history of examination. Invoke at least, as a derived trap,

Re: [[Invoke]] and implicit method calls, once more

2013-10-18 Thread Till Schneidereit
On Fri, Oct 18, 2013 at 8:06 PM, Brandon Benvie bben...@mozilla.com wrote: On 10/18/2013 11:01 AM, Allen Wirfs-Brock wrote: What your question does help me be more decisive on: We should not be in a rush to add an Invoke, InvokeFunction, or any new traps not needed for membranes, and not

Re: [[Invoke]] and implicit method calls, once more

2013-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 11:06 AM, Brandon Benvie wrote: On 10/18/2013 11:01 AM, Allen Wirfs-Brock wrote: What your question does help me be more decisive on: We should not be in a rush to add an Invoke, InvokeFunction, or any new traps not needed for membranes, and not subject to a long

Inconsistent evaluation order in destructuring assignments

2013-10-18 Thread BelleveInvis
In ES5 all assignments are evaluated following this formula: get a reference via evaluating LHSget a value through evaluating RHSassign the value to the reference However in the current draft, destructuring assignment are evaluated in another order which is (as seen in section 12.13.3) get a

Re: Inconsistent evaluation order in destructuring assignments

2013-10-18 Thread Brendan Eich
Yes, this is intentional and goes all the way back to ES4's original destructuring proposal, based on array-pattern destructuring implemented in Opera's Futhark engine. See http://wiki.ecmascript.org/doku.php?id=discussion:destructuring_assignment#contrast_to_normal_assignment We want

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Jason Orendorff
On Fri, Oct 18, 2013 at 12:03 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: for (var x of ) print(x.charCodeAt(0)) invokes print() twice in Gecko. No that's not correct, the @@iterator method of String.prototype is supposed to returns an interator the iterates code points and

Re: has the syntax for proxies been finalized ?

2013-10-18 Thread Rick Waldron
On Friday, October 18, 2013, Angus Croll wrote: thanks André that works! (I was going by https://github.com/tvcutsem/harmony-reflect/blob/master/doc/traps.mdwhich says 'delete') Cc Tom Van Cutsem to make sure he sees this. Rick @angustweets On Fri, Oct 18, 2013 at 9:38 AM, André

Re: Inconsistent evaluation order in destructuring assignments

2013-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 12:24 PM, BelleveInvis wrote: ...this causes an inconsistency that in expression `[f().x] = [g()]`, g is called BEFORE f. That is weird, and differ from `f().x = g()` where g is called after f. but consider [f().x, h().y] = g(); //assume g() evaluates to an

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Andrea Giammarchi
fair enough, that was my point about except for RAM and CPU, life is going to be easier for devs so my counter-question would be: is there any way to do that in core so that we can “”.split() it so that we can have an ArrayLike that with [1] gives back the single “” and not the whole thing

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Mathias Bynens
On 18 Oct 2013, at 11:05, Anne van Kesteren ann...@annevk.nl wrote: On Fri, Oct 18, 2013 at 4:58 PM, Mathias Bynens math...@qiwi.be wrote: I disagree. In those situations you should just iterate over the string using `for…of`. That seems to iterate over code units as far as I can tell.

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 1:12 PM, Andrea Giammarchi wrote: fair enough, that was my point about except for RAM and CPU, life is going to be easier for devs so my counter-question would be: is there any way to do that in core so that we can “”.split() it so that we can have an ArrayLike

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Mathias Bynens
Please ignore my previous email; it has been answered already. (It was a draft I wrote up this morning before I lost my internet connection.) On 18 Oct 2013, at 11:57, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Given that we have charAt, charCodeAt and codePointAt, I think the most

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Mathias Bynens
On 18 Oct 2013, at 15:12, Andrea Giammarchi andrea.giammar...@gmail.com wrote: so my counter-question would be: is there any way to do that in core so that we can “”.split() it so that we can have an ArrayLike that with [1] gives back the single “” and not the whole thing ? This brings

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Andrea Giammarchi
If I understand Allen answer looks like `Array.from(“”).length` would do, being 3, and making the operation straight forward? Cheers On Fri, Oct 18, 2013 at 1:33 PM, Mathias Bynens math...@qiwi.be wrote: On 18 Oct 2013, at 15:12, Andrea Giammarchi andrea.giammar...@gmail.com wrote: so

Interesting: A Simple Visual Model for Promises

2013-10-18 Thread Mark S. Miller
At http://flippinawesome.org/2013/10/14/a-simple-visual-model-for-promises/. I enjoyed it. -- Cheers, --MarkM ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Joshua Bell
Given that you can only use the proposed String.prototype.at() properly for indexes 0 if you know the index of a non-BMP character or lead surrogate by some other means, or if you will test the return value for a trailing surrogate, is it really an advantage over using codePointAt /

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 1:29 PM, Allen Wirfs-Brock wrote: Array.from( '팆팆팆'))[1] maybe even better: Uint32Array.from( '팆팆팆'))[1] Allen ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 4:01 PM, Allen Wirfs-Brock wrote: On Oct 18, 2013, at 1:29 PM, Allen Wirfs-Brock wrote: Array.from( '팆팆팆'))[1] maybe even better: Uint32Array.from( '팆팆팆'))[1] err...maybe not if you want a string value: String.fromCodePoint(Uint32Array.from( '팆팆팆')[1])

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread André Bargull
On Oct 18, 2013, at 4:01 PM, Allen Wirfs-Brock wrote: / // On Oct 18, 2013, at 1:29 PM, Allen Wirfs-Brock wrote: // // Array.from( '???'))[1] // // maybe even better: // // Uint32Array.from( '???'))[1] / err...maybe not if you want a string value:

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Mathias Bynens
On 18 Oct 2013, at 17:51, Joshua Bell jsb...@google.com wrote: Given that you can only use the proposed String.prototype.at() properly for indexes 0 if you know the index of a non-BMP character or lead surrogate by some other means, or if you will test the return value for a trailing

Re: `String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

2013-10-18 Thread Domenic Denicola
On 19 Oct 2013, at 01:12, Mathias Bynens math...@qiwi.be wrote: `String.prototype.codePointAt` or `String.prototype.at` come in handy in case you only need to get the first code point or symbol in a string, for example. Are they useful for anything else, though? For example, if I wanted to get