implicit
over view bounds SC-R1065View bound is a feature in the older versions of Scala that allowed you to view at a type A
as if it were some other type, say B
using the syntax A <% B
. However, this feature is now deprecated and is now recommended that you use implicit
parameters instead. In layman's terms, an implicit
is an entity that is provided or injected automatically by the language as deemed appropriate. If the language cannot provide an implicit
, you'll have to provide one yourself.
def m[T <% Ordering[T]](): Unit = {
//
}
def m[T](implicit ord: Ordering[T]): Unit = {
//
}