Skip to content

Symbol[[description]] cannot be undefined #5833

Open
@boingoing

Description

@boingoing

Due to the way we store a PropertyRecord in the [[description]] slot for Javascript symbols, we aren't able to assign [[description]] to undefined. This has a subtle effect but is observable:

let empty = Symbol('');
let undef = Symbol();
console.log(
  {[empty](){}}[empty].name === '[]', // true
  {[undef](){}}[undef].name === '', // true
);

With the implementation of Symbol.prototype.description (#5828), this limitation is much easier to observe:

undefined === Symbol().description; // true

It's not a straight-forward change to make so I've opened this issue for tracking.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions