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

2013-10-19 Thread Andrea Giammarchi
so it's a for/of with a break when it finds a code point? if that's the only use case I'd like to have an example of how convenient it is. I am just wondering, not saying is not useful (trying to understand when/where/why I'd like to use .at()) Thanks On Fri, Oct 18, 2013 at 10:12 PM, Mathias

Object.assign and __proto__ property

2013-10-19 Thread teramako
Hi I believe Object.assign never update the target's [[prototype]]. But current rev19 spec is using Put. So I'm afraid of following case will update the [[prototype]]. var soruce = {}; Object.defineProperty(source, __proto__, { value: { a: A, b: B }, enumerable: true }); var target =

Re: Object.assign and __proto__ property

2013-10-19 Thread Rick Waldron
On Sat, Oct 19, 2013 at 10:25 AM, teramako teram...@gmail.com wrote: Hi I believe Object.assign never update the target's [[prototype]]. But current rev19 spec is using Put. So I'm afraid of following case will update the [[prototype]]. var soruce = {}; Object.defineProperty(source,

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

2013-10-19 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 10:53 PM, Domenic Denicola wrote: 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

Re: Object.assign and __proto__ property

2013-10-19 Thread Allen Wirfs-Brock
On Oct 19, 2013, at 7:55 AM, Rick Waldron wrote: On Sat, Oct 19, 2013 at 10:25 AM, teramako teram...@gmail.com wrote: Hi I believe Object.assign never update the target's [[prototype]]. But current rev19 spec is using Put. So I'm afraid of following case will update the

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

2013-10-19 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 4:22 PM, André Bargull wrote: 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

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

2013-10-19 Thread Bjoern Hoehrmann
* Allen Wirfs-Brock wrote: The utility of a hypothetical 'at' method is presumably exactly that of 'codePointAt'. str.at(p) would just be a convenience for expressing String.fromCodePoint(str.codePointAt(p)) So the real question is probably, how common is that use case. Certainly not

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

2013-10-19 Thread Mathias Bynens
On 19 Oct 2013, at 12:15, Bjoern Hoehrmann derhoe...@gmx.net wrote: Certainly not common enough to warrant a two-character method on the native string type. Odds are people will use it incorrectly in an attempt to make their code look concise […] Are you saying that changing the name to

@@toStringTag sounds like a function

2013-10-19 Thread Nathan Wall
The name `@@toStringTag` sounds like a function, like `toString` and `toFixed`, but it's just a string property.  The fact that `@@toPrimitive` is a function further makes the point. Has just `@@stringTag` been considered? Nathan

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

2013-10-19 Thread Mathias Bynens
On 19 Oct 2013, at 00:53, Domenic Denicola dome...@domenicdenicola.com wrote: 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

RE: @@toStringTag sounds like a function

2013-10-19 Thread Domenic Denicola
It's toString tag, not to StringTag. ___ 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-19 Thread Domenic Denicola
From: Mathias Bynens [mailto:math...@qiwi.be] This brings us back to the earlier discussion of whether something like `String.prototype.codePoints` should be added: http://esdiscuss.org/topic/how-to-count-the-number-of-symbols-in-a-string It could be a getter or a generator… Or does

Re: Object.assign and __proto__ property

2013-10-19 Thread Andrea Giammarchi
here again dunder keyword ^_^ As it is Object.assign does not bring any benefit over ```javascript for(var key in source) { target[key] = source[key]; } ``` except former pattern can easily filter undesired properties such ```javascript for(var key in source) { if (key != '__proto__') {

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

2013-10-19 Thread Andrea Giammarchi
AFAIK that's also what Allen said didn't want to implement in core. An expensive operation per each invocation due stateless loop over arbitrary indexes. Although, strings are immutable in JS so I'd implement that logic creating a snapshot once and use that as if it was an Array ... something

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

2013-10-19 Thread Andrea Giammarchi
example mroe readable and with some typo fixed in github: https://gist.github.com/WebReflection/7059536 license wtfpl v2 http://www.wtfpl.net/txt/copying/ Cheers On Sat, Oct 19, 2013 at 11:18 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: AFAIK that's also what Allen said didn't

Re: static/class properties

2013-10-19 Thread Dmitry Soshnikov
On Thu, Sep 19, 2013 at 9:20 PM, Dmitry Soshnikov dmitry.soshni...@gmail.com wrote: On Sep 19, 2013, at 6:30 AM, Rick Waldron wrote: On Thu, Sep 19, 2013 at 4:16 AM, Dmitry Soshnikov dmitry.soshni...@gmail.com wrote: Hi, Out of curiosity: we have static methods, but seems there is no

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

2013-10-19 Thread Bjoern Hoehrmann
* Mathias Bynens wrote: On 19 Oct 2013, at 12:15, Bjoern Hoehrmann derhoe...@gmx.net wrote: Certainly not common enough to warrant a two-character method on the native string type. Odds are people will use it incorrectly in an attempt to make their code look concise […] Are you saying that

RE: @@toStringTag sounds like a function

2013-10-19 Thread Nathan Wall
Domenic Denicola wrote: It's toString tag, not to StringTag. Ah, you know, I hadn't made that connection.  That's interesting. I still think I would prefer something else... maybe even just `@@tag`.  But that certainly makes more sense out of the naming. Thanks! Nathan

Re: @@toStringTag sounds like a function

2013-10-19 Thread Brendan Eich
@@tagForToString? Er, no. It's actually not the whole return value of any toString call, of course. It is the %s in [object %s] returned by Object.prototype.toString.call(x) for an object x. This suggests @@objectToStringTag or something along those lines. Does that help? /be Nathan Wall

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

2013-10-19 Thread Brendan Eich
Allen Wirfs-Brock wrote: The use case that we don't support well is any sort of back wards iteration of the characters of a string. We don't current have an iterator specified to do it, nor do we have a one stop way to test whether we at looking at the trailing surrogate of a surrogate pair.