On Sat Jan 03 2015 at 6:30:43 PM Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:
> Agreed with Brendan,
> and I've thought the same.
>
> It's been also years we have problems using unknonw objects in the wild,
> i.e.
>
> ```js
> var n = {__proto__:null};
> var s = String(n); // error, No default value
> var s = '' + n; // error, No default value
> ```
> Same if used as [property accessor] so I am not sure why `String(o)` when
> `o` is `Symbol` should not throw.
>
> I'd expect it to throw all the time and let developers be a bit more
> careful on their explicit or implicit casts.
>
> The `toString` and `valueOf` are great examples that could compromise a
> lot of real-world code.
>
> Being `Symbols` new we should probably/hopefully get them in the right way.
>
> I feel like throwing either cases is the right way.
>
That example above is pretty compelling for throw always consistency.
Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150103/d233f186/attachment.html>
d at domenic.me (2015-01-12T17:54:14.522Z)
That example above is pretty compelling for throw always consistency.
On Sat Jan 03 2015 at 6:30:43 PM Andrea Giammarchi < andrea.giammarchi at gmail.com> wrote: > Agreed with Brendan, > and I've thought the same. > > It's been also years we have problems using unknonw objects in the wild, > i.e. > > ```js > var n = {__proto__:null}; > var s = String(n); // error, No default value > var s = '' + n; // error, No default value > ``` > Same if used as [property accessor] so I am not sure why `String(o)` when > `o` is `Symbol` should not throw. > > I'd expect it to throw all the time and let developers be a bit more > careful on their explicit or implicit casts. > > The `toString` and `valueOf` are great examples that could compromise a > lot of real-world code. > > Being `Symbols` new we should probably/hopefully get them in the right way. > > I feel like throwing either cases is the right way. > That example above is pretty compelling for throw always consistency. Rick -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150103/d233f186/attachment.html>