I know you can create an anonymous function, and have the compiler infer its return type:
val x = () => { System.currentTimeMillis }
Just for static typing's sake, is it possible to specify its return type as well? I think it would make things a lot clearer.
val x = () => { System.currentTimeMillis } : String
does not compile. Or do you mean something else? – Castrato