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

Closed
annevk opened this Issue May 17, 2016 · 8 comments

Comments

Projects
None yet
5 participants
@annevk
Contributor

annevk commented May 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.)

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb May 17, 2016

Member

This seems both unconfusing and like it will reduce verbosity without reducing clarity.

Member

ljharb commented May 17, 2016

This seems both unconfusing and like it will reduce verbosity without reducing clarity.

@domenic

This comment has been minimized.

Show comment
Hide comment
@domenic

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.

Member

domenic commented May 17, 2016

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.

@jmdyck

This comment has been minimized.

Show comment
Hide comment
@jmdyck

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]]().

Collaborator

jmdyck commented May 18, 2016

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]]().

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

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.

Member

ljharb commented May 18, 2016

To me, an internal method is just a function-valued internal slot - exactly like an object method is just a function-valued object property.

@jmdyck

This comment has been minimized.

Show comment
Hide comment
@jmdyck

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.

Collaborator

jmdyck commented May 18, 2016

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.

@bterlson

This comment has been minimized.

Show comment
Hide comment
@bterlson

bterlson Jun 2, 2016

Member

Using dot notation everywhere seems fine to me. Anyone want to tackle this regexp replacement? :-P

Member

bterlson commented Jun 2, 2016

Using dot notation everywhere seems fine to me. Anyone want to tackle this regexp replacement? :-P

@jmdyck

This comment has been minimized.

Show comment
Hide comment
@jmdyck

jmdyck Jun 2, 2016

Collaborator

I'll have a go.

Collaborator

jmdyck commented Jun 2, 2016

I'll have a go.

jmdyck added a commit to jmdyck/ecma262 that referenced this issue Jun 2, 2016

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 tc39#574)

jmdyck added a commit to jmdyck/ecma262 that referenced this issue Jun 2, 2016

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 tc39#574)

jmdyck added a commit to jmdyck/ecma262 that referenced this issue Jun 3, 2016

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 tc39#574)

bterlson added a commit that referenced this issue Jun 3, 2016

Editorial: use dot notation for accessing internal slots (#591)
* 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)
@bterlson

This comment has been minimized.

Show comment
Hide comment
@bterlson

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.

Member

bterlson commented Jun 9, 2016

Alright, this seems done. We don't use it for internal methods, but that can be considered separately in #595.

@bterlson bterlson closed this Jun 9, 2016

domenic added a commit to domenic/browser-payment-api that referenced this issue Dec 13, 2016

Switch internal slot notation to ., not @
Fixes w3c#336. See the history here in whatwg/streams#178tc39/ecma262#574tc39/ecma262#591whatwg/streams@7791c58. My bad for leading people down this path.

domenic added a commit to domenic/browser-payment-api that referenced this issue Dec 13, 2016

Switch internal slot notation to ., not @
Fixes w3c#336. See the history here in whatwg/streams#178tc39/ecma262#574tc39/ecma262#591whatwg/streams@7791c58. My bad for leading people down this path.

marcoscaceres added a commit to w3c/payment-request that referenced this issue Dec 13, 2016

Switch internal slot notation to ., not @ (#370)
Fixes #336. See the history here in whatwg/streams#178tc39/ecma262#574tc39/ecma262#591whatwg/streams@7791c58. My bad for leading people down this path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment