Le 26 août 2014 à 17:39, Jeff Walden jwalden...@mit.edu a écrit :
On 08/12/2014 11:07 PM, Allen Wirfs-Brock wrote:
sounds good to me, I'll update the spec. accordingly
On Aug 12, 2014, at 7:39 PM, Erik Arvidsson wrote:
I was suggesting that String(symbol) should not throw.
This can
On 08/12/2014 11:07 PM, Allen Wirfs-Brock wrote:
sounds good to me, I'll update the spec. accordingly
On Aug 12, 2014, at 7:39 PM, Erik Arvidsson wrote:
I was suggesting that String(symbol) should not throw.
This can be spec'ed as String( value ) checking the Type of the value and
special
.
From: es-discuss es-discuss-boun...@mozilla.org on behalf of Jeff Walden
jwalden...@mit.edu
Sent: Tuesday, August 26, 2014 11:39
To: Allen Wirfs-Brock; Erik Arvidsson
Cc: es-discuss@mozilla.org
Subject: Re: String(symbol)
On 08/12/2014 11:07 PM, Allen Wirfs-Brock wrote
On 08/26/2014 08:48 AM, Domenic Denicola wrote:
Why would it be useful, from a programmer's perspective, to expose ToString
directly?
People will always want to polyfill, or prototype in advance of proposal for
standardization. No matter how internal the operation might be, it's heavily
Le 26 août 2014 à 17:39, Jeff Walden jwalden...@mit.edu a écrit :
On 08/12/2014 11:07 PM, Allen Wirfs-Brock wrote:
With this change, as far as I can tell there's no concise operation directly
corresponding to the ToString abstract operation. The best that seems
possible is some horribly
Claude Pache wrote:
Personally, I use the following expression in order to coerce a variable to a
string:
var obj = this + ''
and its in-place variant:
x += ''
I think it'll continue to work in ES6.
Agreed, this is the correct-and-most-concise way to do it. It should
On 08/26/2014 09:14 AM, Brendan Eich wrote:
Claude Pache wrote:
Personally, I use the following expression in order to coerce a variable to
a string:
var obj = this + ''
and its in-place variant:
x += ''
I think it'll continue to work in ES6.
Agreed, this is the
Claude Pache wrote:
/ Personally, I use the following expression in order to coerce a variable to
a string:
//
// var obj = this + ''
//
// and its in-place variant:
//
// x += ''
//
// I think it'll continue to work in ES6.
/
Agreed, this is the correct-and-most-concise way
To: Claude Pache; Jeff Walden
Cc: Erik Arvidsson; es-discuss@mozilla.org
Subject: Re: String(symbol)
Claude Pache wrote:
Personally, I use the following expression in order to coerce a variable to a
string:
var obj = this + ''
and its in-place variant:
x += ''
I think it'll continue
Brendan Eich wrote:
Use +'' if you want ToString in the language, I say.
asm.js points the way on other explicit conversion forms:
ToString(x) is x+''
ToNumber(x) is +x
ToInt32(x) is ~~x
ToBoolean(x) is !!x
/be
___
es-discuss mailing list
Jeff Walden wrote:
It's not the most correct way to do it. |a + | performs ToPrimitive(a, hint
= None), whereas ToString(a) performed ToPrimitive(a, hint = String). The former
consults valueOf, then toString, the latter the reverse.
Argh, I had forgotten about the no-hint case there. It
sounds good to me, I'll update the spec. accordingly
On Aug 12, 2014, at 7:39 PM, Erik Arvidsson wrote:
symbol + '' must continue to throw.
I was suggesting that String(symbol) should not throw.
This can be spec'ed as String( value ) checking the Type of the value and
special case
Out of mere curiosity, why is it desired that `symbol + ''` throw?
Nathan
On Tue, Aug 12, 2014 at 10:39 PM, Erik Arvidsson erik.arvids...@gmail.com
wrote:
symbol + '' must continue to throw.
I was suggesting that String(symbol) should not throw.
This can be spec'ed as String( value
On Tue, Aug 12, 2014 at 10:39 PM, Erik Arvidsson erik.arvids...@gmail.com
wrote:
symbol + '' must continue to throw.
I was suggesting that String(symbol) should not throw.
This can be spec'ed as String( value ) checking the Type of the value and
special case it in case of the value
a string property name from a symbol.
Allen
Nathan
On Tue, Aug 12, 2014 at 10:39 PM, Erik Arvidsson erik.arvids...@gmail.com
wrote:
symbol + '' must continue to throw.
I was suggesting that String(symbol) should not throw.
This can be spec'ed as String( value ) checking the Type
Right now String(symbol) throws because it uses ToString which is spec'ed
to throw.
I'm suggesting that we special case String(value) to do a type check for
Symbol and return the same string as Symbol.prototype.toString.call(value)
does.
https://people.mozilla.org/~jorendorff/es6-draft.html#sec
Le 12 août 2014 à 22:35, Erik Arvidsson erik.arvids...@gmail.com a écrit :
Right now String(symbol) throws because it uses ToString which is spec'ed to
throw.
I'm suggesting that we special case String(value) to do a type check for
Symbol and return the same string
symbol + '' must continue to throw.
I was suggesting that String(symbol) should not throw.
This can be spec'ed as String( value ) checking the Type of the value and
special case it in case of the value being a symbol.
On Tue, Aug 12, 2014 at 5:17 PM, Claude Pache claude.pa...@gmail.com
wrote
18 matches
Mail list logo