-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Prior art to safe assignment operator proposal #41
Comments
In one way it's not. With a try keyword, you can inline unsafe calls. Given that the error is the first tuple index in the result and is either [fn1, fn2, fn3].map(fn => try fn()).filter(err => err === null) ...
I don't think this is a real issue. |
No you can't. The same way |
@arthurfiorette Depends on the implementation. |
Sure, that's the reason of a proposal :) But im more in favor of a throw like exactly to avoid expressions like |
Prerequisites
Versions
I like the idea of assignment operator,
It is even better then new keyword
try
in a couple of ways:await
expressionWith the name
SafeAssignmentExpression
, or something like this. It is easier to implement in parsers then overridetry
keyword (which is also possible).A couple years ago I wrote:
They uses similar approach but works in all JavaScript engines:
Also I wrote a proposal which has list of modules, that uses similar approach, and share it on ES forum, there is a lot so idea is popular. Maybe you can reuse some of this information in your proposal.
Also there is implementation of transforming
try
expression totryCatch
in goldstein which you can try and reuse.Just added support of
safe operator
to goldstein here is how it looks like:transformed to:
Thank you for you work on a proposal, I hope one day it will be part of JavaScript!
The text was updated successfully, but these errors were encountered: