I am curious as to why I am able to re-declare the type of a type-paramertized argument to a scala function like this:
// original
def ident[T](z:T) = z
def echo[T](x:T) = {
ident(x)
}
echo("hi")
Which behaves exactly the same as this:
// modified with what seems to be a useless re-specification of the original type
def ident[T](z:T) = z
def echo[T](x:T) = {
ident(x:T) // <<< --- we specify type 'T' here, but not in the orig
}
echo("hi")
What is this language construct called? Does it have a name? And are there circumstances in which it would actually be useful?