-
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
Add explanatory note on method extraction with extended member expressions #3
Comments
Given that
and
Rather than
Which would at least violate the principle of least surprise for me. |
@ckknight That's right, and it makes sense if you think of For example, these are equivalent: typeof a.b.c;
typeof (a.b).c; But they are not equivalent to: (typeof a.b).c; On the other hand, my feeling is that the prefix form of |
What about var f = obj::a.b.c; Is it equivalent to var f = a.bind(obj).b.c rather than var f = a.b.c.bind(obj) ? |
Dot var f = (a.b.c).bind(obj); Which is what esdown outputs. If you go to http://zenparsing.github.io/esdown/repl/ and type in: .translate var f = obj::a.b.c I'm wondering though, if having both the unary form and binary form is too confusing, and if one should win out, which would it be? |
Actually, it doesn't really surprise me that much. It appears that it acts more like this: ::a.b
a::a.b
a.b.bind(a)
::a.b.c
a.b::a.b.c
(a.b).c.bind(a.b)
::a.b.c.d
a.b.c::a.b.c.d
(a.b.c).d.bind(a.b.c) That's exactly what I would expect to see with the unary form. And as for having two different forms for the same operator, I don't see the problem. Now, I do agree that the right hand side for the unary form should be exclusively limited to |
Explain the behavior of something like:
The text was updated successfully, but these errors were encountered: