Skip to content

Commit

Permalink
added several early syntax errors (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
rickbutton authored Mar 6, 2020
1 parent 57cd0e9 commit 581682c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,20 @@ We define a record or tuple expression by using the `#` modifier in front of oth
#[1, 2, #{ a: 3 }]
```
#### Early Errors
Holes are prevented in syntax, unlike Arrays, which allow holes. See [issue #84](https://github.com/tc39/proposal-record-tuple/issues/84) for more discussion.
```js
const x = #[,]; // SyntaxError, holes are disallowed by syntax
```
Using the `__proto__` identifier as a property is prevented in syntax. See [issue #46](https://github.com/tc39/proposal-record-tuple/issues/46) for more discussion.
```js
const x = #{ __proto__: foo }; // SyntaxError, __proto__ identifier prevented by syntax

const y = #{ "__proto__": foo }; // valid, creates a record with a "__proto__" property.
```
#### Runtime verification
At runtime, attempting to create a `Record` with a `symbol` key is a `TypeError`.
Expand Down

0 comments on commit 581682c

Please sign in to comment.