Implicit coercion of Symbols
brendan at mozilla.org
Sat Jan 3 20:36:30 PST 2015
Alex Kocharin wrote:
> 04.01.2015, 05:44, "Rick Waldron" <waldron.rick at gmail.com>:
>> On Sat Jan 03 2015 at 9:41:57 PM Alex Kocharin <alex at kocharin.ru
>> <mailto:alex at kocharin.ru>> wrote:
>> Also, if you want to prevent mistakes like `object['blah' +
>> symbol]`, linters could be changed to forbid/warn about
>> concatenation inside property names.
>> How would a linter know that `symbol` was actually a Symbol?
> It wouldn't. But if it warns about string concatenation inside square
> braces (means, string + variable, but not number + variable), it
> should be good enough. This is the error the spec is trying to
> prevent, isn't it?
No. See the JQuery examples that bz provided.
> My point is: concatenating Symbols with other strings have legitimate
> do this, it isn't a statically typed language.
Static types have nothing to do with getting an error on implicit
More information about the es-discuss