-
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: Specify _prefix_ for non-specific uses of CreateBuiltinFunction #2833
base: main
Are you sure you want to change the base?
Editorial: Specify _prefix_ for non-specific uses of CreateBuiltinFunction #2833
Conversation
One problem that this PR doesn't fix is that "the name [that is] given to the function in this specification" is ambiguous. E.g., if the header says Or consider that sometimes the specification gives more than one name to a function. E.g. |
For the former, more formalism would be good, but i don’t think anyones actually implemented the wrong thing there. For the latter, the spec does explicitly say - one defers to the real one from whence the name comes. |
Explicitly, the |
Also, just stylistically, I think this:
is putting too much stuff into a single sentence. I think I'd prefer to see it broken out into multiple sentences, maybe bullet points, maybe with examples. Possibly combined with the case analysis of the subsequent paragraph (though I haven't thought too much about what that would look like). |
Yes, it does - the name is determined by where the function is defined; https://tc39.es/ecma262/#sec-set.prototype.keys says it's defined here, and that function's name is "values". |
I have removed "the name [that is] given to the function in this specification" (which is not necessary because every function is either anonymous or associated with a property name, e.g. "eval" for |
That's a reasonable assumption, but the spec doesn't actually say that. (It could say that, or something like it.)
That would certainly be true if there were an explicit sentence saying:
but there isn't. To ascertain that value, it comes back to this one paragraph in clause 18, which is not set up to decide this case. One sentence says:
And I'm pointing out that, as far as that wording is concerned, the spec "gives" two different names to this function. Another sentence says:
which indicates that if a program accesses the function in question via Again, I'm not saying that there isn't a reasonable way to resolve this, I'm saying that the spec doesn't itself give wording that clearly decides the case. |
"the property name of the property for which the function is defined as the value" This phrase fails the above Set.prototype.{values,keys} case: a single function is defined as the value of two properties with different names. |
@jmdyck Fixed with a constraint and explanatory note. |
@jmdyck there is only one function definition - the other points to it. I really don't understand how any other interpretation could be made. |
I appreciate the explanatory note. I think the preceding sentence is sufficient now, but it's still conveying a lot of ideas in a complex subordinate clause. One way to divide it into more digestible chunks would be a construction something like this:
(Or you could leave the other property out of it, and instead define the name in terms of the section header, but I think that might be worse.) |
I'm not disputing either of those statements. I said as much 5 posts ago. We don't seem to be getting anywhere, so I'll stop trying. |
Thanks; I like this approach. The latest commit incorporates text derived from it. |
5d5368c
to
51a5efd
Compare
…are used for distinct properties
Always derive CreateBuiltinFunction _name_ and _prefix_ from the defining section, either by processing an explicit name or by referring to property name and disposition, and don't assume a value of "name" except as set by that operation.
51a5efd
to
3442d6c
Compare
CreateIntrinsics fails to specify the value of prefix in its calls to CreateBuiltinFunction, and early text in ECMAScript Standard Built-in Objects incorrectly suggests that the name parameter is always the initial value of the "name" property (which is not the case when "name" is something like "[Symbol.iterator]"). This PR corrects those issues and attempts to improve text of the latter section.