-
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: usage of "!" #1097
Comments
I would expect and desire every abstract operation to be prefixed by a ? or a ! - to me, the lack of a prefix means that it returns a Completion Record, which means the algorithm must be checking whether it’s abrupt or not. That the number of changes to achieve this consistency is large doesn’t, to me, detract from the value of the change. |
Indeed, if you take the view that every operation returns a completion record, then you have to use '?' or '!' if you want to explicitly inline-extract the [[Value]]. (Of course, you could also rely on implicit [[Value]]-extraction.) However, I don't subscribe to that view. |
I like the idea of maintaining metadata somewhere about which abstract operations return completion records (i.e., which may throw) and which do not. cc @domenic who I believe suggested this in the past. This issue reminds me a bit of tc39/proposal-bigint#10 : There are some concepts for when things sort of implicitly become completion records and when not, and it's not immediately obvious to everyone what's going on. |
Dang, I forgot about #486. I'll close this as a duplicate of that. |
(Picking up from #1096 (comment).)
For an operation (abstract, syntax-directed, or type-directed), we can distinguish two possibilities:
For convenience here, we can refer to "can-throw operations" and "can't-throw operations". (There are abrupt completions other than throw-completions, but the latter appear to be of more interest.)
For a can-throw operation, we expect that generally, its invocations will be prefixed by "!" or "?", depending on whether or not the circumstances of the invocation guarantee that the return value won't be an abrupt completion.
But the question raised in PR #1096 relates to can't-throw operations: should their invocations be prefixed by "!" ?
Some numbers: (These are my counts. Your mileage may vary.)
The spec has 4247 operation-invocations. Of these,
Of those prefixed with "!",
The text was updated successfully, but these errors were encountered: