-
Notifications
You must be signed in to change notification settings - Fork 6
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
Why not define a standard helper function #24
Comments
Error is indeed already magical. New forms of magic must be avoided. Stacks exist, so the motivation for this proposal is unchanged - not being in the spec just means we can't use the spec to alter or constrain them. |
This is already covered in the explainer: https://github.com/tc39/proposal-throw-expressions?tab=readme-ov-file#other-notes |
@rbuckton I don't think it was satisfactory covered. Specifically this seems incorrect:
|
A user-defined If an engine optimizes |
A real function/method has problem, but as I suggested, we could consider meta method: |
That would indeed be a viable approach - but only because it's syntax, which is what this issue seems to be trying to avoid. |
I think people generally don't mind whether it's a real method, and not really try to avoid syntax. It's all about ergonomics -- instead of forcing parens |
How do you want your pseudo function call, JavaScript style |
@theScottyJam the former would be fine, but would be syntax, as would the latter. |
@Jack-Works your exact example shows it pointing to the |
but the error stack is not |
You're correct, but that still results in user confusion. |
if it is a built-in function, this won't happen. |
This is a continuation of the discussion here: #23 (comment)
There are a couple of obvious solutions that don't require changing the syntax:
@ljharb objected:
My response to that is that if stacks aren't in the spec, then 90% of the motivation for this proposal disappears. In any case it would be a QoI issue. It is not any more magical than Error already is.
The text was updated successfully, but these errors were encountered: