-
Notifications
You must be signed in to change notification settings - Fork 30
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
Should unary form have a static restriction? #4
Comments
I'd say yes, otherwise what would |
Without a restriction, it would bind |
tc39#4: No good use case for it. There are only two possible use cases for `::func`: 1. You want to bind the function to `undefined` so it cannot be re-bound by the caller. - Use `undefined::func` or `func.bind(undefined)` as it's more explicit of the intent. 2. You just want to pass the function as an argument. - Binding is unnecessary here. Just use `func`. Because `::func` is equivalent to `func.bind(undefined)`, and `func()` is equivalent to `undefined::func()`, there is no other use case for this.
@RReverser I've written up the early error rule similar to the early error rule for "delete", so that the operand can be parenthesized. If that looks good, we'll eventually need to update the parser to allow things like:
|
@zenparsing My implementation already allows things like that. |
So yeah, let's go ahead and resolve this! |
Should the unary form have a static (or even runtime) restriction such that the operand must be a reference type (basically, a property access)?
The text was updated successfully, but these errors were encountered: