-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
There is no conflict with the using proposal, but they relate #63
Comments
I guess this way Are you up to PR this into polyfill.js and README.md? |
That wouldn't work because using requires the value to have the relevant symbol unless the value is null or undefined, in which case it ignores everything. So using will have to be aware of the try operator's value. |
A statement being aware of what is generating the value it's being assigned to doesn't have precedents in any other proposal as far as I know. I agree with what you said above but I'm concerned it may mean that both won't be used together. |
Maybe extend the capabilities of using resource = expr1; maybe if |
Putting the using declaration on a separate line isn't a big deal. Trying to make them work together could start to get very complicated. Especially since we're going the try expression route now with #65. |
This proposal would augment the using proposal, not conflict with it. When both keywords are used, the using expression would attach to the value of
result.ok
Since the using proposal explicitly ignores a using expression which returns null or undefined, using undefined forresult.ok
would in no way conflict, since that is already explicitly allowed by that proposal.Furthermore, according to
await using
the using proposal does not care what the assignment expression is (it could be another local variable), so expanding its semantics to operate onresult.ok
of a try assignment should not affect it.Furthermore, the using proposal does not address what happens when an error is thrown by the dispose function. I'm assuming it would throw from just inside the block as the last statement of the block but it means you can't wrap the disposal in a try catch without wrapping the entire block. It certainly does not expect a try keyword within the block to handle the dispose function.
The using proposal throws if the disposable does not have a dispose function.
The position of the try keyword should determine whether or not this error gets caught by the try keyword.
These should definitely catch the error thrown by
using
.These should not catch the error thrown by
using
.#62 also relates to this decision
The text was updated successfully, but these errors were encountered: