-
Notifications
You must be signed in to change notification settings - Fork 0
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
Actually bind the function #9
Comments
Dupe of #4. |
I think the reasoning is pretty well covered over in the other issue thread. Also, your example is really about method extraction rather than virtual methods. In the following example, we are going to look up a::foo(); Syntactic support for method extraction would be nice, but by itself it's not enough of a win to justify new syntax. In the bind operator strawman, there was something like this for method extraction: (::obj.foo) But that's pretty weird. |
Pretty weird ... or pretty AWESOME!? :P |
My concern is actually just that I would expect: (a::foo)() === a::foo() I find it very surprising that the function call picks up |
@ForbesLindesay that's a fair point, and it the intuitive-ness is definitely a high priority. For the sake of argument though, I've noticed some people that are new to JS think that the following should hold: (a.foo)() === a.foo() Obviously, it doesn't. And in this proposal |
I just don't expect to view var bound = a::foo;
assert(bound() === a::foo()); |
@ForbesLindesay Why do you think that is? Do you think someone who had no prior knowledge of Thanks for your input, BTW. |
I think that a beginner isn't going to be taught I think they will be taught, How would you explain the |
I was hopeful that I'm currently investigating the idea of splitting up the use cases with different syntax. |
@domenic @ForbesLindesay my current thinking is that it would be better to split up the syntax. I'm working on a separate private syntax proposal, and I'll also try to put together a more detailed version of the function bind proposal on the ecmascript wiki. I've actually come around to really liking the method extraction syntax: |
@ForbesLindesay You may have seen this already, but the two new proposals are at: |
Shouldn't it be:
rather than:
The goal being that:
works. Without the binding, the assertion doesn't pass.
The text was updated successfully, but these errors were encountered: