Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Editorial: remove unnecessary shorthand #62

Merged
merged 1 commit into from
Jul 15, 2021

Conversation

jugglinmike
Copy link
Contributor

The MakeIdempotentArrayBufferByteLengthGetter abstract operation never
returns a completion record, abrupt or otherwise, making the "!"
shorthand superfluous.

The MakeIdempotentArrayBufferByteLengthGetter abstract operation never
returns a completion record, abrupt or otherwise, making the "!"
shorthand superfluous.
@ljharb
Copy link
Member

ljharb commented Jul 3, 2021

All AOs return a completion record, always.

@jugglinmike
Copy link
Contributor Author

Huh, I never knew that, maybe because normal completions are implicitly "unwrapped" as well. (For those following along, here's the text which describes that convention.)

@ljharb
Copy link
Member

ljharb commented Jul 3, 2021

Additionally, the point of the ! and ? is so you don’t have to go look at the AO definition to know if it can return abruptly or not.

@jugglinmike
Copy link
Contributor Author

Agreed. Omitting the "!" is an even stronger assertion, signifying not only that the AO will not return abruptly for this call, but that it never returns abruptly anywhere. Which might be why we generally don't write, e.g. "! SameValue(x, y)".

@ljharb
Copy link
Member

ljharb commented Jul 3, 2021

Currently, omitting it signals that the completion record returned is introspected later.

There’s nothing that indicates it can’t ever return abruptly, at the moment.

@syg
Copy link
Collaborator

syg commented Jul 9, 2021

I'm fine with omitting ! here, @ljharb as you know we disagree here. Though I'm tired of arguing about this until we actually do the completion value reform. At least we all agree that the implicit completion wrapping should be improved.

(For @jugglinmike, my preference here is perhaps more aligned with what I think yours is, which is ! and ? only apply if the AO returns completions at all. Simple predicates are the usual AOs that I prefer to not use ! and ? with, though @ljharb is right that omitting them is also currently a signal that the completion record is explicitly examined. Edit: Of course, the "if the AO returns completions at all" bit is messed up by the implicit wrapping that the spec currently has.)

@syg syg merged commit 16645c5 into tc39:master Jul 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants