Symbol description inference
# Allen Wirfs-Brock (9 years ago)
Function name inferencing is possible because function definitions are all syntactic special forms that can be unambiguously identified during parsing.
Symbols creation is just a function call so there is no way to reliably detect it. Symbol might aliased to some other name by assignment, a different value other than the Symbol creation function might be assigned to the global Symbol, or some alternative declaration of Symbol might be in some at the point of use.
# Alexander Jones (9 years ago)
IMO, the real problem that needs solving is macros. Macro-based definition of a symbol could trivially reuse the name.
# Michał Wadas (9 years ago)
Actually I think symbol name interference should be left as implementation detail. So I would change 19.4.1.1 § 2 to allow implementations for custom behavior.
So, we have function name inference, like
and this inference also works similarly with
const foo = () => {}andsuch.
So, how about Symbol description inference, like:
and
const foo = Symbol()and such?Here is my real use case: yarom-and-shahar/cyclejs-shooter/blob/feaaf0ecd7620832b4bff90ab0f701d51ddcf3ff/src/ui-from-state/index.test.js#L22
So, we have function name inference, like ``` const funcs = { foo: () => {} } funcs.foo.name === 'foo' // true ``` and this inference also works similarly with `const foo = () => {}` and such. So, how about Symbol description inference, like: ``` const symbols: { foo: Symbol(), bar: Symbol() } symbols.foo // Symbol(foo) symbols.bar // Symbol(bar) ``` and `const foo = Symbol()` and such? Here is my real use case: https://github.com/yarom-and-shahar/cyclejs-shooter/blob/feaaf0ecd7620832b4bff90ab0f701d51ddcf3ff/src/ui-from-state/index.test.js#L22-L25 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161025/5523ec22/attachment.html>