This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27553 - Support Symbol
Summary: Support Symbol
Status: RESOLVED WORKSFORME
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Domenic Denicola
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-10 13:10 UTC by Anne
Modified: 2017-12-06 11:12 UTC (History)
5 users (show)

See Also:


Attachments

Description Anne 2014-12-10 13:10:47 UTC
JavaScript can now define unique keys. Platform should have that ability as well.
Comment 1 Boris Zbarsky 2014-12-10 19:51:11 UTC
Which parts of this do we need in IDL?

Presumably we need to have a way for "SomeInterface.something" to be a well-known symbol (well-known in the sense that SomeInterface.something === otherWindow.SomeInterface.something), right?

Do we need anything else?  Do we need the ability to put these symbols on Symbol instead of SomeInterface?  (I'd say we don't want that, personally.)
Comment 2 Anne 2014-12-10 21:20:14 UTC
Only SomeInterface, Symbol is for TC39. (Although this will get messy of course once they adopt something from DOM again.)
Comment 3 Boris Zbarsky 2014-12-10 21:31:36 UTC
OK.  So we could support syntax like so:

  interface Foo {
    symbol xyz;
  }

which would make Foo.xyz a well-known symbol whose [[Description]] is "Foo.xyz", right?

Do we also need the ability to have symbol-named things on dictionaries or something?
Comment 4 Erik Arvidsson 2015-01-09 20:11:32 UTC
Should probably be:

  interface Foo {
    static Symbol xyz;
  }

and then the rules for Symbol would have to define that all code realms need to share the Symbol xyz, just like ES6 defines the well known symbols: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-well-known-symbols
Comment 5 Anne 2017-12-06 11:12:56 UTC
Part of this got addressed by https://github.com/heycam/webidl/pull/377. If the other part is still needed it's probably best to file a new issue for that. It's unclear at this point whether there are use cases.