-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use "." notation for all internal slots #574
Comments
This seems both unconfusing and like it will reduce verbosity without reducing clarity. |
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. |
The spec already has Object.[[X]] in a few places, but I believe all occurrences are for internal methods, not internal slots. E.g., |
To me, an internal method is just a function-valued internal slot - exactly like an object method is just a function-valued object property. |
(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. |
Using dot notation everywhere seems fine to me. Anyone want to tackle this regexp replacement? :-P |
I'll have a go. |
Specifically, change: the [[Foo]] internal slot of _O_ -> _O_.[[Foo]] (132 occ) _O_'s [[Foo]] internal slot -> _O_.[[Foo]] (265 occ) (Resolves issue tc39#574)
Specifically, change: the [[Foo]] internal slot of _O_ -> _O_.[[Foo]] (132 occ) _O_'s [[Foo]] internal slot -> _O_.[[Foo]] (265 occ) (Resolves issue tc39#574)
Specifically, change: the [[Foo]] internal slot of _O_ -> _O_.[[Foo]] (132 occ) _O_'s [[Foo]] internal slot -> _O_.[[Foo]] (265 occ) (Resolves issue tc39#574)
* Editorial: change "the arguments object" to "_args_" ... in the 4 places where it is preceded by: Let _args_ be the arguments object. (Prep for subsequent refactor.) * Editorial: use dot notation for accessing internal slots Specifically, change: the [[Foo]] internal slot of _O_ -> _O_.[[Foo]] (132 occ) _O_'s [[Foo]] internal slot -> _O_.[[Foo]] (265 occ) (Resolves issue #574)
Alright, this seems done. We don't use it for internal methods, but that can be considered separately in #595. |
Fixes w3c#336. See the history here in whatwg/streams#178 → tc39/ecma262#574 → tc39/ecma262#591 → whatwg/streams@7791c58. My bad for leading people down this path.
Fixes w3c#336. See the history here in whatwg/streams#178 → tc39/ecma262#574 → tc39/ecma262#591 → whatwg/streams@7791c58. My bad for leading people down this path.
Fixes #336. See the history here in whatwg/streams#178 → tc39/ecma262#574 → tc39/ecma262#591 → whatwg/streams@7791c58. My bad for leading people down this path.
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.)
The text was updated successfully, but these errors were encountered: