Skip to content

Editorial: add RequireInternalSlot abstract operation#1373

Merged
ljharb merged 1 commit intotc39:masterfrom
ljharb:require_slot
Apr 10, 2019
Merged

Editorial: add RequireInternalSlot abstract operation#1373
ljharb merged 1 commit intotc39:masterfrom
ljharb:require_slot

Conversation

@ljharb
Copy link
Copy Markdown
Member

@ljharb ljharb commented Dec 17, 2018

To me, this seems like a nice way to DRY up a common operation - asserting that a value is an Object with a given internal slot.

What are your thoughts on this? Is this too much indirection, or does this reduction in spec lines make it easier to read?

It was a pretty quick change, mostly a single regex operation, so I'm happy to close it if we don't think this is an improvement.

@domenic
Copy link
Copy Markdown
Member

domenic commented Dec 17, 2018

Cf. #354 . This seems like a simpler version of what was proposed there: slightly less readable/intuitive IMO, but also a smaller delta from the existing conventions.

@ljharb
Copy link
Copy Markdown
Member Author

ljharb commented Dec 17, 2018

@domenic Thanks, good callout! if we can figure out a better convention as in #354, I don't think this change would make that transition harder (although it probably wouldn't make it all that much easier).

@zenparsing
Copy link
Copy Markdown
Member

I like this approach; it aids readability while not sacrificing explicitness.

@bakkot
Copy link
Copy Markdown
Member

bakkot commented Dec 18, 2018

Thinking about internal slots as first-class values which can be passed around (in the spec) makes my heard hurt a bit, but I don't see a fundamental problem it it.

@zenparsing
Copy link
Copy Markdown
Member

@bakkot I know what you mean, but we already make liberal use of it with ObjectCreate.

@bakkot
Copy link
Copy Markdown
Member

bakkot commented Dec 18, 2018

we already make liberal use of it with ObjectCreate

So we do! I'd forgotten.

@ljharb ljharb removed the request for review from bterlson February 28, 2019 19:54
@ljharb ljharb assigned ljharb and unassigned bterlson Feb 28, 2019
Edit made with a regex search:
  Input: `( *)(1)\. If Type\(_([^_]+)_\) is not Object, throw a \*TypeError\* exception\.\n\11\. If _\3_ does not have (?:an?) \[\[([^\]]+)\]\] internal slot, throw a \*TypeError\* exception\.`
  Output: `$1$2. Perform ? RequireInternalSlot(_$3_, [[$4]]).`
@ljharb ljharb merged commit 3fc53bc into tc39:master Apr 10, 2019
@ljharb ljharb deleted the require_slot branch April 10, 2019 22:43
jmdyck added a commit to jmdyck/ecma262 that referenced this pull request Apr 12, 2019
jmdyck added a commit to jmdyck/ecma262 that referenced this pull request Apr 29, 2019
ljharb pushed a commit to jmdyck/ecma262 that referenced this pull request May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants