You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Or something like fn bar(&self, x: _, y: _, z: _) -> _ { ... } to make it obvious that a inferred/blank type is being used.)
I'm personally ambivalent on this; it may result in
some tooling being harder to write,
confusing error messages,
code that subtly changes behaviour if an upstream trait changes method definitions slightly, but the method body uses that argument in a way that is satisfied by both the old and new types. e.g. TreeMap<uint, T> becoming ~[T]: they both have a methods called insert and remove with the same signature, but they have different performance and semantics. (WIth explicit signatures, the downstream code would stop compiling, rather than changing behaviour.)
The text was updated successfully, but these errors were encountered:
FWIW, another somewhat similar case is items declared inside fns. Theoretically if you have an fn or static declared inside the body of an fn, you could infer its type without breaking the principle of "no type inference at the API level". It probably doesn't make much difference from the perspective of complicating the type inference algorithm, though. (This is different from the case in the OP in that this is actually type inference, while that's something much simpler: just instantiating type parameters.)
My personal feeling w.r.t. both of these is that they're interesting possibilities but also tremendously unimportant, i.e.: I don't feel like we need to make a decision either way, we can just note the possibility (as we have) and come back to it (much) later when we don't have way more important things to think about.
From reddit.
The trait definition entirely determines the signatures of impl'd methods, and so the signature is known without examining the function body, e.g.
(Or something like
fn bar(&self, x: _, y: _, z: _) -> _ { ... }
to make it obvious that a inferred/blank type is being used.)I'm personally ambivalent on this; it may result in
TreeMap<uint, T>
becoming~[T]
: they both have a methods calledinsert
andremove
with the same signature, but they have different performance and semantics. (WIth explicit signatures, the downstream code would stop compiling, rather than changing behaviour.)The text was updated successfully, but these errors were encountered: