I had a crazy thought for how to make method call syntax unambiguously
distinguishable from field access without making it ugly.
In short: make `a.b(c, d)` *always* a method call, rather than parsing
it as a call to a value stored in a field. If you actually wanted to
call a closure in a field, you would make that explicit by writing
`(a.b)(c, d)`.
Thoughts?
Background: Currently, the expression `a.b` is rather ambiguous. What
we do is to check whether `a` has a field named `b`. If there is no
such type, then we search for a method named `b`. This ambiguity is
somewhat confusing at times (e.g., #2327). It also causes problems with
having a field and a method with the same name, which is sometimes
necessary to fulfill an iface etc.
Niko
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev