Skip to content
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

Editorial: standardizing preambles for concrete methods and internal methods #1981

Closed
jmdyck opened this issue May 4, 2020 · 6 comments · Fixed by #1994
Closed

Editorial: standardizing preambles for concrete methods and internal methods #1981

jmdyck opened this issue May 4, 2020 · 6 comments · Fixed by #1994

Comments

@jmdyck
Copy link
Collaborator

jmdyck commented May 4, 2020

As a follow-up to PR #1914 etc, I'm thinking about standardizing the preambles for concrete methods and internal methods, and I'm looking for some editorial direction.

Concrete methods and internal methods are similar in that the method's target is not named in the method's parameter list, so must be named elsewhere.

For concrete methods, the target-alias is always declared in an algorithm step (typically the algorithm's first), e.g.:

1. Let _envRec_ be the global Environment Record for which the method was invoked.

or

1. Let _module_ be this Cyclic Module Record.

For internal methods, it's usually done in the preamble, e.g.

When the [[DefineOwnProperty]] internal method of an Array exotic object _A_ is called ...

or

The [[Call]] internal method for an ECMAScript function object _F_ is called with ...

but there are also a few cases where it's done in an algorithm step, e.g.:

1. Let _args_ be the arguments object.

Given that, I wonder if you have any preferences for:

  • where the target-alias is introduced (preamble vs algorithm step vs somewhere else)?
  • the wording by which it is introduced?
  • the wording of the preamble (if that's not covered by the previous)?
@michaelficarra michaelficarra added the editor call to be discussed in the next editor call label May 4, 2020
@michaelficarra
Copy link
Member

I prefer it in the preamble, with wording like

When the [[DefineOwnProperty]] internal method of an Array exotic object A is called ...

@jmdyck
Copy link
Collaborator Author

jmdyck commented May 5, 2020

One thing about that wording is that it doesn't parallel the standard wording for abstract operations, i.e.:

The abstract operation (name) takes (arguments) and returns (return-type). (Other description.) It performs the following steps when called:

so it's unclear what the ellipsis represents. E.g., were you thinking this?:

When the (name) (concrete|internal) method of (target-type) (target-alias) is called with (arguments), it returns (return-type). (Other description.) It performs the following steps when called:

If so, we could eliminate the repeated "when [it is] called" and move closer to the standard form for abstract operations with something like:

The (name) (concrete|internal) method of (target-type) (target-alias) takes (arguments) and returns (return-type). (Other description.) It performs the following steps when called:

@michaelficarra
Copy link
Member

E.g., were you thinking this?:

Indeed, I was thinking of that kind of wording, but I am okay with either of the two options you listed. I guess the latter is a little nice because it's more similar to the AO preamble wording.

@michaelficarra michaelficarra removed the editor call to be discussed in the next editor call label May 6, 2020
@bakkot
Copy link
Contributor

bakkot commented May 6, 2020

The (name) (concrete|internal) method of (target-type) (target-alias) takes (arguments) and returns (return-type). (Other description.) It performs the following steps when called:

Editor group talked about it and is in favor of this form. (Except I'm not entirely sure what "target-alias" would look like here; can you give a concrete example?)

@michaelficarra
Copy link
Member

@bakkot It's _A_ in

When the [[DefineOwnProperty]] internal method of an Array exotic object _A_ is called ...

@bakkot
Copy link
Contributor

bakkot commented May 7, 2020

So, concretely,

The [[DefineOwnProperty]] internal method of an Array exotic object A takes arguments P (a property key) and Desc (a Property Descriptor) and returns a Completion Record. It performs the following steps when called:

jmdyck added a commit to jmdyck/ecma262 that referenced this issue May 15, 2020
... rather than the algorithm, for internal methods of an arguments exotic object.

(See issue tc39#1981)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue May 15, 2020
jmdyck added a commit to jmdyck/ecma262 that referenced this issue May 15, 2020
... according to the format of issue tc39#1981.
(And introduce preambles where before there was none.)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue May 15, 2020
jmdyck added a commit to jmdyck/ecma262 that referenced this issue May 16, 2020
jmdyck added a commit to jmdyck/ecma262 that referenced this issue May 16, 2020
... according to the format of issue tc39#1981.
(And introduce preambles where before there was none.)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue May 16, 2020
... according to the format of issue tc39#1981.

(In the process, drop occurrences of
"implements the corresponding Module Record abstract method"
from the current preambles: it doesn't add anything.)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue May 16, 2020
... according to the format of issue tc39#1981.
(And introduce preambles where before there was none.)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue May 16, 2020
... according to the format of issue tc39#1981.

(In the process, drop occurrences of
"implements the corresponding Module Record abstract method"
from the current preambles: it doesn't add anything.)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue Oct 20, 2020
... rather than the algorithm, for internal methods of an arguments exotic object.

(See issue tc39#1981)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue Oct 20, 2020
jmdyck added a commit to jmdyck/ecma262 that referenced this issue Oct 20, 2020
... according to the format of issue tc39#1981.
(And introduce preambles where before there was none.)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue Oct 20, 2020
... according to the format of issue tc39#1981.

(In the process, drop occurrences of
"implements the corresponding Module Record abstract method"
from the current preambles: it doesn't add anything.)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue Dec 1, 2020
... rather than the algorithm, for internal methods of an arguments exotic object.

(See issue tc39#1981)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue Dec 1, 2020
jmdyck added a commit to jmdyck/ecma262 that referenced this issue Dec 1, 2020
... according to the format of issue tc39#1981.
(And introduce preambles where before there was none.)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue Dec 1, 2020
... according to the format of issue tc39#1981.

(In the process, drop occurrences of
"implements the corresponding Module Record abstract method"
from the current preambles: it doesn't add anything.)
jmdyck added a commit to jmdyck/ecma262 that referenced this issue Dec 13, 2020
Reword preambles for internal methods into the format set out in issue tc39#1981.

- Declare the target-alias in the preamble rather than the algorithm,
  for internal methods of an arguments exotic object.

- Drop the target-alias from the preamble when the algorithm doesn't reference it.

- Fill in some missing parameter-types.

Also, delete "(which|that) was created using the bind function"
from the [[Call]] and [[Construct]] preambles for bound functions.
The wording suggested that there could be bound functions that
*weren't* created using the 'bind' function, and that these things
would have their own [[Call]] and [[Construct]] methods.
jmdyck added a commit to jmdyck/ecma262 that referenced this issue Dec 13, 2020
Reword existing preambles and fill in missing ones
according to the format set out in issue tc39#1981.

----

HasThisBinding() + HasSuperBinding():
- When the algorithm is simply returning a specific Boolean value,
  create a Note after the algorithm re providing (or not) the binding
  (moving the sentence from preamble if applicable).
- Reword re use of the word "regular" (avoid it or explain it).

----

Present never-invoked concrete methods more consistently.

Specifically, present DeleteBinding for module ER
more like CreateImmutableBinding for object ER.

- Don't say it "refuses to delete bindings",
  because that sounds like it throws an error if invoked,
  when in fact it's never invoked.

- Drop the emu-alg that just asserts it's never invoked.
jmdyck added a commit to jmdyck/ecma262 that referenced this issue Dec 13, 2020
Reword preambles according to the format set out in issue tc39#1981.

(In the process, drop occurrences of
"implements the corresponding Module Record abstract method"
from the former preambles: it doesn't add anything.)
ljharb pushed a commit to jmdyck/ecma262 that referenced this issue Dec 13, 2020
Reword preambles for internal methods into the format set out in issue tc39#1981.

- Declare the target-alias in the preamble rather than the algorithm,
  for internal methods of an arguments exotic object.

- Drop the target-alias from the preamble when the algorithm doesn't reference it.

- Fill in some missing parameter-types.

Also, delete "(which|that) was created using the bind function"
from the [[Call]] and [[Construct]] preambles for bound functions.
The wording suggested that there could be bound functions that
*weren't* created using the 'bind' function, and that these things
would have their own [[Call]] and [[Construct]] methods.
ljharb pushed a commit to jmdyck/ecma262 that referenced this issue Dec 13, 2020
…ods (tc39#1994)

Reword existing preambles and fill in missing ones
according to the format set out in issue tc39#1981.

----

HasThisBinding() + HasSuperBinding():
- When the algorithm is simply returning a specific Boolean value,
  create a Note after the algorithm re providing (or not) the binding
  (moving the sentence from preamble if applicable).
- Reword re use of the word "regular" (avoid it or explain it).

----

Present never-invoked concrete methods more consistently.

Specifically, present DeleteBinding for module ER
more like CreateImmutableBinding for object ER.

- Don't say it "refuses to delete bindings",
  because that sounds like it throws an error if invoked,
  when in fact it's never invoked.

- Drop the emu-alg that just asserts it's never invoked.
ljharb pushed a commit to jmdyck/ecma262 that referenced this issue Dec 13, 2020
…c39#1994)

Reword preambles according to the format set out in issue tc39#1981.

(In the process, drop occurrences of
"implements the corresponding Module Record abstract method"
from the former preambles: it doesn't add anything.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants