Conversation

I do variations of this in C++ all the time too. Maybe languages with complex enough type systems should have a "raise a diagnostic with the type of this expression" operator and a REPL for the type system
Quote Tweet
let x: String = definitely_not_a_string; is my favorite way to figure out actual types for things.
6
43
For the places where `_` isn't syntactically allowed, the Rust compiler will tell you what the type was with an applicable suggestion (very handy for fn return types). Alas, it is allowed in `let x: _ = foo;`
2
11
See also the holes in Idris, Agda, and Purescript. There's only so much we can do with automated hole filling - as Rust is impure, so more things have the same type. But there might be ways of pruning the number of suggestions… I think GHC added some improvements at some stage.
1
2