The parametric type T is not really used to express any relationship between types, so there is little excuse for using it, which just adds unnecessary complexity.
Here is an example where you need to use a parametric type:
function pow{T <: Real}(base::T, exponent::T) base^power end
In this case, T needs to ensure that both base and exponent the same type with the restriction that this type must be a subtype of Real .
The constrast here uses the same function without using the parametric type:
function pow(base:: Real, exponent:: Real) base^power end
Now these functions require both base and exponent be subtypes of Real , but there is no type relationship that ensures that both are of the same subtype of Real .
source share