-
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
Editorial: inconsistent prose for intrinsics #2576
Comments
To me, either they’re all functions, or the only methods are the ones that look at the receiver. |
That would make it easy.
I.e., the ones that reference |
Yes. |
I think we're already mostly consistent with the rule @ljharb gives, with a few exceptions. Or, almost but not quite equivalently, we could say that anything on a The exceptions fall into a few categories, at a quick glance.
|
I think that the Promise statics should be described as methods, along with the from/of's; the Maths should be functions; and "intentionally non-generic" should have no impact on the classification. |
…just the final property name ... rather than by "full paths". That is, change: - `Number.parseFloat` to *"parseFloat"* - `Number.parseInt` to *"parseInt"* - %TypedArray%`.prototype.toString` to *"toString"* - `Date.prototype.toGMTString` to *"toGMTString"* This increases consistency among sentences of this particular form. (But note that they're a small fraction of a large class of sentences being considered by issue tc39#2576, whose resolution could 'overturn' this choice, or other choices made in this PR.)
I'm pretty sure @bakkot wasn't saying it should, rather that it was the occasion of anomalies in the status quo. Specifically, the current spec has 26 occurrences of "not generic" and 56 of "intentionally generic", and in all but 3 cases, the subject is referred to as a "function", even though in many (most?) cases the preamble referred to it as a "method". |
Note that 4.4.37 defines "method" as "function that is the value of a property", which includes just about every intrinsic function. So that definition should probably change. |
Use consistent prose when the initial values of two intrinsic-properties are the same object. In the sentences affected by this PR, refer to properties by just the final property name rather than by "full paths". That is, change: - `Number.parseFloat` to *"parseFloat"* - `Number.parseInt` to *"parseInt"* - %TypedArray%`.prototype.toString` to *"toString"* - `Date.prototype.toGMTString` to *"toGMTString"* This increases consistency among sentences of this particular form. (But note that they're a small fraction of a large class of sentences being considered by issue tc39#2576, whose resolution could 'overturn' this choice, or other choices made in this PR)
... mainly the Math.* functions. See Issue tc39#2576 for some discussion.
(In most cases, the clause already refers to it as a "method" in some other sentence.) See Issue tc39#2576 for some discussion.
The clause that defines an intrinsic function (other than an acccessor function) gives its parameter list in the clause heading. Often, the preamble re-states the parameter list. This commit (and the next) deletes those repeats. (See Issue tc39#2576 for justification.) In this commit, we handle all the simple cases where nothing is lost by deleting the repeat.
... mainly the Math.* functions. See Issue tc39#2576 for some discussion.
(In most cases, the clause already refers to it as a "method" in some other sentence.) See Issue tc39#2576 for some discussion.
The clause that defines an intrinsic function (other than an acccessor function) gives its parameter list in the clause heading. Often, the preamble re-states the parameter list. This commit (and the next) deletes those repeats. (See Issue tc39#2576 for justification.) In this commit, we handle all the simple cases where nothing is lost by deleting the repeat.
... mainly the Math.* functions. See Issue tc39#2576 for some discussion.
(In most cases, the clause already refers to it as a "method" in some other sentence.) See Issue tc39#2576 for some discussion.
The clause that defines an intrinsic function (other than an acccessor function) gives its parameter list in the clause heading. Often, the preamble re-states the parameter list. This commit (and the next) deletes those repeats. (See Issue tc39#2576 for justification.) In this commit, we handle all the simple cases where nothing is lost by deleting the repeat.
... mainly the Math.* functions. See Issue tc39#2576 for some discussion.
(In most cases, the clause already refers to it as a "method" in some other sentence.) See Issue tc39#2576 for some discussion.
The clause that defines an intrinsic function (other than an acccessor function) gives its parameter list in the clause heading. Often, the preamble re-states the parameter list. This commit (and the next) deletes those repeats. (See Issue tc39#2576 for justification.) In this commit, we handle all the simple cases where nothing is lost by deleting the repeat.
... mainly the Math.* functions. See Issue tc39#2576 for some discussion.
(In most cases, the clause already refers to it as a "method" in some other sentence.) See Issue tc39#2576 for some discussion.
The clause that defines an intrinsic function (other than an acccessor function) gives its parameter list in the clause heading. Often, the preamble re-states the parameter list. This commit (and the next) deletes those repeats. (See Issue tc39#2576 for justification.) In this commit, we handle all the simple cases where nothing is lost by deleting the repeat.
... mainly the Math.* functions. See Issue tc39#2576 for some discussion.
(In most cases, the clause already refers to it as a "method" in some other sentence.) See Issue tc39#2576 for some discussion.
The clause that defines an intrinsic function (other than an acccessor function) gives its parameter list in the clause heading. Often, the preamble re-states the parameter list. This commit (and the next) deletes those repeats. (See Issue tc39#2576 for justification.) In this commit, we handle all the simple cases where nothing is lost by deleting the repeat.
... mainly the Math.* functions. See Issue tc39#2576 for some discussion.
(In most cases, the clause already refers to it as a "method" in some other sentence.) See Issue tc39#2576 for some discussion.
The clause that defines an intrinsic function (other than an acccessor function) gives its parameter list in the clause heading. Often, the preamble re-states the parameter list. This commit (and the next) deletes those repeats. (See Issue tc39#2576 for justification.) In this commit, we handle all the simple cases where nothing is lost by deleting the repeat.
... mainly the Math.* functions. See Issue tc39#2576 for some discussion.
(In most cases, the clause already refers to it as a "method" in some other sentence.) See Issue tc39#2576 for some discussion.
The clause that defines an intrinsic function (other than an acccessor function) gives its parameter list in the clause heading. Often, the preamble re-states the parameter list. This commit (and the next) deletes those repeats. (See Issue tc39#2576 for justification.) In this commit, we handle all the simple cases where nothing is lost by deleting the repeat.
I'm looking at making the prose for intrinsics more consistent. (PR #2575 is a start.)
There are many points of inconsistency. Here are a few to start with.
(1) (a) How should the spec refer to a built-in function within its defining clause?
Object.assign
function")assign
function")[(b) Later: Similarly, how should we refer to a property of an intrinsic?]
(c) Also, sometimes these say "function" and sometimes "method", and I don't think there's a rule that governs which is used. E.g., Object.freeze is "the
freeze
function", but in the next clause, Object.fromEntries is "thefromEntries
method".(2) Sometimes the preamble re-states the heading's parameter list, sometimes it doesn't.
Personally, I suggest dropping the parameter list in the preamble.
Re the last point, wording such
When the `foo` function is called with arguments _x_ and _y_, the following steps are taken:
suggests that it might be called in some other way, with some other behavior. Whereas
When the `foo` function is called, the following steps are taken:
doesn't have that problem.
The text was updated successfully, but these errors were encountered: