Le 27 déc. 2014 à 08:41, Claude Pache claude.pa...@gmail.com a écrit :
I guess that V8 follows an old version of the spec draft. That particular
behaviour was modified in Rev 28. See:
https://bugs.ecmascript.org/show_bug.cgi?id=3252
—Claude
In fact, that bug was for the particular
The first one makes no sense to me, since a symbol can be used as a property
key. The latter one makes sense but the error should be Cannot convert a
Symbol value to a string.
From: a...@rauschma.de
Date: Sat, 27 Dec 2014 08:17:40 +0100
Both exceptions make a lot of sense, but I don’t see that
Here is a more complete answer. In fact, the behaviour should be different in
each your two cases. More inline.
Le 27 déc. 2014 à 08:17, Axel Rauschmayer a...@rauschma.de a écrit :
This is current V8 behavior:
```
let obj = {};
obj[Object(Symbol())] = true;
TypeError: Cannot convert
From: Claude Pache claude.pa...@gmail.com
To: Axel Rauschmayer a...@rauschma.de
Cc: Erik Arvidsson erik.arvids...@gmail.com, es-discuss list
es-discuss@mozilla.org
Date: Sat, 27 Dec 2014 09:04:43 +0100
Subject: Re: Throwing when symbol *wrappers* are converted to primitives
Le 27 déc
This is current V8 behavior:
```
let obj = {};
obj[Object(Symbol())] = true;
TypeError: Cannot convert object to primitive value
'' + Object(Symbol())
TypeError: Cannot convert a Symbol wrapper object to a primitive value
```
Both exceptions make a lot of sense, but I don’t see that in the
I guess that V8 follows an old version of the spec draft. That particular
behaviour was modified in Rev 28. See:
https://bugs.ecmascript.org/show_bug.cgi?id=3252
—Claude
Le 27 déc. 2014 à 08:17, Axel Rauschmayer a...@rauschma.de a écrit :
This is current V8 behavior:
```
let obj = {};
Interesting, thanks! Can you explain the rationale behind that decision? To me,
it seems like V8’s behavior is preferable – if I accidentally created instances
of `Symbol`, I would want to get errors as early as possible.
On 27 Dec 2014, at 08:41, Claude Pache claude.pa...@gmail.com wrote:
7 matches
Mail list logo