archives

« Bugzilla Issues Index

#4422 — Do Symbols have a [[Description]] or [[SymbolData]] internal slot?


§6.1.5 <http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types-symbol-type> says:

> Each Symbol value immutably holds an associated value called [[Description]]
> that is either undefined or a String value.

§19.4.4 <http://www.ecma-international.org/ecma-262/6.0/#sec-properties-of-symbol-instances> says:

> Symbol instances have a [[SymbolData]] internal slot.

Now, which one? Or do they have both? Both slots seem to be used throughout the spec.

It looks like the [[SymbolData]] is some kind of self-referential slot that is used only for identifying whether a value is a symbol. Do we really need both of these?

Not sure whether this is a technical issue (only one slot should be used) or an editorial issue (both slots should be mentioned, in notes as well as in the initialisation / creation of symbols).


Ooops, I've realised my mistake. I confused symbol *values* with `Symbol` wrapper object *instances*, probably because primitive values that "hold" a [[Description]] which looks like a slot but is an "associated value" are strange :-)

Maybe §19.4.4

> The [[SymbolData]] internal slot is the Symbol value represented by this Symbol object.

should be changed to something more obvious like

The [[SymbolData]] internal slot holds the primitive symbol value represented by this Symbol object.

but I guess it's not really necessary.