-
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
Binding while destructuring #5
Comments
I can see how that would be useful. And natural if you view autobinding as a special "kind" of [[Get]]. I think the first option would be better. We'd have to special-case the object destructuring cover grammar to accept property names in the form
but only in destructuring patterns. It would have to be an error in an object literal, in the same way that ({ x = y }); is a syntax error. Let's leave this open for now. |
In your proposed syntax, @domenic, how would one represent destructured parameters with mismatching key/identifiers? Your example:
If we wanted to have a different identifier, which is more appropriate?
or
It seems like, at least with these syntaxes, there's an awful lot of overloading of what |
I think it would be the former, |
Closing this for now, we can revisit later. |
Can this proposal be reopen to focus on this? And maybe, another use cases similar to this one. This use case is not something that you could solve using the pipe operators, as what you want is actually have the function binded to the parameter. |
I just ran into a case today where I wanted to convert an API from
to
for performance and ergonomic benefits. (whatwg/streams#309)
However, this has a pretty sad downside that I can't use destructuring for cases where it might be clearer. That is, this won't work:
It would be pretty cool if the method-extraction half of the bind operator could help me out in this context. Maybe...
or...
The text was updated successfully, but these errors were encountered: