Toying with Rust, I\'m extracting some code into a class. To keep it self-contained but separate functionality, I want to hang onto a callback function and call it later.
foo.bar(...)
is always parsed as a method call, it never looks for fields. This avoids ambiguity, especially with traits. One can force it to be a field access by separating the call and the field access into two distinct expressions, for example,
let f = self.go;
f(n)
Or, better, just (self.go)(n)
.
Issue #2392 covers improving these diagnostics.