-
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: Eliminate "unknown" as a parameter type #2745
Conversation
spec.html
Outdated
@@ -9274,7 +9274,7 @@ <h1>Contains</h1> | |||
<emu-clause id="sec-static-semantics-contains" oldids="sec-object-initializer-static-semantics-contains,sec-static-semantics-static-semantics-contains,sec-function-definitions-static-semantics-contains,sec-arrow-function-definitions-static-semantics-contains,sec-generator-function-definitions-static-semantics-contains,sec-async-generator-function-definitions-static-semantics-contains,sec-class-definitions-static-semantics-contains,sec-async-function-definitions-static-semantics-Contains,sec-async-arrow-function-definitions-static-semantics-Contains" type="sdo"> | |||
<h1> | |||
Static Semantics: Contains ( | |||
_symbol_: unknown, | |||
_symbol_: a grammar symbol, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is "a grammar symbol" something defined already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a term that the spec uses already, but (as with most grammar-related terms) it's not defined with a <dfn>
.
a80692d
to
76fe65d
Compare
(force-pushed to resolve merge conflicts) |
FYI #2842 handles the 5 |
Yes, I was planning to deal with those once #2744 was merged, but bakkot beat me to it!
Yup. There will probably be some lurking in in-flight PRs though. |
(force-pushed to resolve merge conflicts) |
spec.html
Outdated
@@ -39963,7 +39962,7 @@ <h1>Map ( [ _iterable_ ] )</h1> | |||
<emu-clause id="sec-add-entries-from-iterable" type="abstract operation"> | |||
<h1> | |||
AddEntriesFromIterable ( | |||
_target_: unknown, | |||
_target_: an ordinary object, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this worth calling out over just saying an Object
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to say if the benefit is worth the cost, because they're both fairly small (I think). I'm okay either way, whatever the editors want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmdyck Decision from editor call was to not use "an ordinary object" as a parameter type unless that refinement was needed for the algorithm steps (which it isn't here).
spec.html
Outdated
@@ -40907,7 +40906,7 @@ <h1> | |||
<h1> | |||
DetachArrayBuffer ( | |||
_arrayBuffer_: an ArrayBuffer, | |||
optional _key_: unknown, | |||
optional _key_: an ECMAScript language value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the spec isn't very clear on this point. I'll change it to anything
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, DetachArrayBuffer
passes _key_
to SameValue()
, which only accepts language values, which is presumably why I set _key_
's type to an ECMAScript language value
. I'll leave it that way unless something else changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should probably change the SameValue
usage here to simply is
. We can talk about it at the editor call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmdyck Decision from editor call was to make the value as opaque as possible, so any
would be better here. That will also necessitate the change from SameValue
to is
for comparison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise.
force-pushed to rebase to main and address review comments. |
Force-pushed to rebase to main. |
(force-pushed to resolve merge conflict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than the CreateBuiltInFunction thing.
I didn't review in full detail, but the types all look reasonable.
spec.html
Outdated
@@ -13865,7 +13865,7 @@ <h1> | |||
CreateBuiltinFunction ( | |||
_behaviour_: an Abstract Closure, a set of algorithm steps, or some other definition of a function's behaviour provided in this specification, | |||
_length_: a non-negative integer or +∞, | |||
_name_: a property key, | |||
_name_: a property key or a Private Name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe CreateBuiltinFunction actually does take a Private Name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this, but consider:
class Outer {
#Inner = class {};
}
I think the (inner) ClassExpression will be passed with a Private Name to NamedEvaluation, which then invokes ClassDefinitionEvaluation, which then invokes CreateBuiltinFunction to create the constructor method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yup, that's correct. The default class constructor case hadn't occurred to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
SameValue accepts only ECMAScript language values as args, so DetachArrayBuffer's use of SameValue asserts that detach keys are ECMAScript language values. But detach keys should be as opaque as possible, so replace `SameValue` with `is`.
(force-pushed to squash it down to 2 commits) |
SameValue accepts only ECMAScript language values as args, so DetachArrayBuffer's use of SameValue asserts that detach keys are ECMAScript language values. But detach keys should be as opaque as possible, so replace `SameValue` with `is`.
In the current spec, there are
250240 AO/SDO parameters with a type of "unknown". This PR replacesalmostall of those unknowns with a reasonable type.I say "almost all" because it skips:the 3_state_
parameters handled by PR Editorial: Declare "JSON Serialization Record" #2741, andthe 5_V_
and_W_
parameters of GetValue, PutValue, and InitializeReferencedBinding, because they're weird, and need some attention before they can get sensible types.(PR #2741 and PR #2842 have both been merged, so the above exceptions have already been dealt with.)
The PR is broken into commits according to what replaces "unknown", in case that helps review. Squash before merging.