-
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: refer to numeric methods as we do other AOs #2546
Conversation
spec.html
Outdated
@@ -19322,7 +19478,11 @@ <h1>Runtime Semantics: Evaluation</h1> | |||
<emu-alg> | |||
1. Let _lhs_ be the result of evaluating |LeftHandSideExpression|. | |||
1. Let _oldValue_ be ? ToNumeric(? GetValue(_lhs_)). | |||
1. Let _newValue_ be ! Type(_oldValue_)::add(_oldValue_, Type(_oldValue_)::unit). | |||
1. If Type(_oldValue_) is Number, then | |||
1. Let _newValue_ be ! Number::add(_oldValue_, *1*<sub>𝔽</sub>). |
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 inlined and removed the ::unit
constants, since they were described as the multiplicative identity, but only ever used in additive positions. Plus, it just makes sense to use 1 literally in the increment/decrement algorithms.
61a4946
to
0545b3e
Compare
@bakkot Comments addressed. |
spec.html
Outdated
<tr><td> `&` </td><td> _T_::bitwiseAND </td></tr> | ||
<tr><td> `^` </td><td> _T_::bitwiseXOR </td></tr> | ||
<tr><td> `|` </td><td> _T_::bitwiseOR </td></tr> | ||
<tr><th> _opText_ </th><th> Type(_lnum_) </th><th> _operation_ </th></tr> |
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 love having these duplicated - it would maybe be better to have rowspan=2
?
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.
since the lightweight table doesn't have cell borders, that would render confusingly
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 comments.
I think having these automatically link is well worth the slight overhead in amount of prose.
@bakkot Comments addressed. |
afdea7a
to
d1c1837
Compare
Is that the rationale for this PR? The initial comment didn't really say. |
The original motivation for the PR was to more precisely capture the return types for these operations - to talk sensibly about the return type of e.g. This matters more with #2547, which is where the issue came up. However, separately, I think having these automatically link is enough motivation on its own. |
Okay, but
That one says "not ready for review", so I'm trying not to look at it.
Yup, could be. |
Yes, but you have to know which you're calling for that to be useful at the call site. Otherwise you end up with exactly the same lack of precision - you don't know if your value is a completion record or not. Hence this PR. |
Right! But if you don't know which you're calling in the status quo, how do you think this PR improves that? E.g., if the status quo has |
Sure, but then you don't have a mixed return type at an individual callsite. |
In particular, mixed between a completion record and a non completion record. |
Well, you don't have a mixed return type at the callsites of Looking at this example more realistically, this PR doesn't actually unfold/inline any invocation of
This PR unfolds calls to:
where the return type is Boolean regardless of
where the result type does depend on So I don't think this PR changes any callsite where the return type mixes a completion record and a non completion record. |
d1c1837
to
a714cfd
Compare
Hm, interesting. Still, that doesn't explain why this PR unfolds |
If we're not going to use |
And we're not going to use it consistently because in some cases it has a 'mixed' return type? |
Yup. |
Okay. I'm not sure I agree it's an improvement, but at least the rationale is clearer now. |
This leaves the
::
in the names for now to make the diff a little easier. We can rename the AOs in a follow-up if we think it's worth it.