Lets say I have something like:
case class StringList(list: List[String]) {
final def isEmpty(): Boolean = list.isEmpty
}
Theoretically, the Scala compiler could optimise calls to the method isEmpty()
and make them static...so that I don't have to write this:
object StringList {
implicit class StringListExtensions(val strList: StringList) extends AnyVal {
def isEmpty(): Boolean = strList.list.isEmpty
}
}
or this:
object StringList {
def isEmpty(strList: StringList): Boolean = strList.list.isEmpty
}