Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upUse "." notation for all internal slots #574
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ljharb
May 17, 2016
Member
This seems both unconfusing and like it will reduce verbosity without reducing clarity.
|
This seems both unconfusing and like it will reduce verbosity without reducing clarity. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
domenic
May 17, 2016
Member
Yeah, I agree with @ljharb.
At first I thought it was important to distinguish records from JS objects, but doing that by choosing what sigil should be used to access their state is dumb. (I.e., it doesn't help in cases where you're not accessing state, but just using the variable.)
Then I thought it was important to distinguish internal slot access from property access, but that is already done by the [[ notation.
So this seems unambiguous and a clear win.
|
Yeah, I agree with @ljharb. At first I thought it was important to distinguish records from JS objects, but doing that by choosing what sigil should be used to access their state is dumb. (I.e., it doesn't help in cases where you're not accessing state, but just using the variable.) Then I thought it was important to distinguish internal slot access from property access, but that is already done by the [[ notation. So this seems unambiguous and a clear win. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jmdyck
May 18, 2016
Collaborator
The spec already has Object.[[X]] in a few places, but I believe all occurrences are for internal methods, not internal slots. E.g., IsExtensible() invokes _O_.[[IsExtensible]]().
|
The spec already has Object.[[X]] in a few places, but I believe all occurrences are for internal methods, not internal slots. E.g., |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ljharb
May 18, 2016
Member
To me, an internal method is just a function-valued internal slot - exactly like an object method is just a function-valued object property.
|
To me, an internal method is just a function-valued internal slot - exactly like an object method is just a function-valued object property. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jmdyck
May 18, 2016
Collaborator
To me, an internal method is just a function-valued internal slot
(Presumably you mean "function" in a general sense, not the ES-specific sense.)
I think the spec is mostly okay with that interpretation. But note that:
- [[RegExpMatcher]] is not referred to as an internal method even though it's an internal slot whose value is an algorithm.
- Invoking an object's internal method is not quite as simple as invoking the value of an algorithm-valued internal slot: the former also sets the 'target' of the invocation.
Bringing it back to the subject of this issue, I think using dot notation makes more sense for internal slots than it does for internal methods; since the spec is already using it for methods, might as well for slots too.
(Presumably you mean "function" in a general sense, not the ES-specific sense.) I think the spec is mostly okay with that interpretation. But note that:
Bringing it back to the subject of this issue, I think using dot notation makes more sense for internal slots than it does for internal methods; since the spec is already using it for methods, might as well for slots too. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bterlson
Jun 2, 2016
Member
Using dot notation everywhere seems fine to me. Anyone want to tackle this regexp replacement? :-P
|
Using dot notation everywhere seems fine to me. Anyone want to tackle this regexp replacement? :-P |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I'll have a go. |
added a commit
to jmdyck/ecma262
that referenced
this issue
Jun 2, 2016
jmdyck
referenced this issue
Jun 2, 2016
Merged
Editorial: use dot notation for accessing internal slots #591
added a commit
to jmdyck/ecma262
that referenced
this issue
Jun 2, 2016
added a commit
to jmdyck/ecma262
that referenced
this issue
Jun 3, 2016
added a commit
that referenced
this issue
Jun 3, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bterlson
Jun 9, 2016
Member
Alright, this seems done. We don't use it for internal methods, but that can be considered separately in #595.
|
Alright, this seems done. We don't use it for internal methods, but that can be considered separately in #595. |
annevk commentedMay 17, 2016
Instead of "The [[X]] internal slot value of Object" it seems we could simply use Object.[[X]] as is already done for Records. Or is there a reason there is this distinction?
(FWIW, the WHATWG Streams Standard uses Object@[[X]] as convention and folks don't really understand why it's different, including the editor, who defers to this repository.)