Sometimes one might want to declare x to be of the same type as y. With vals type inference handles this very well, but this does not
x
y
vals
My first stab:
class Decl[T] { type Type = T } object Decl { def apply[T](x: T) = new Decl[T] }
For example, if we have some variable x whose type we don't want to state explicitly:
val d = Decl(x) type TypeOfX = d.Type