chakra-core / chakra-core/ChakraCore

Symbol[[description]] cannot be undefined

Open
#5,833 0 comments 1 reaction 0 assignees View on GitHub
ES Spec Conformance
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

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:

```js
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:

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

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.