I would like to know if I can find this functionality in the Scala standard libraries.
Scala provides a wrapper around java.lang.String called WrappedString :
final class WrappedString(val self: String) extends AbstractSeq[Char] with IndexedSeq[Char] with StringLike[WrappedString]
At startup:
f("he", "hello")
The compiler implicitly converts the string literal to an instance of WrappedString via Predef.wrapString :
f[String]("he", "hello")({ ((s: String) => scala.this.Predef.wrapString(s)) });
In turn, WrappedString extends IndexedSeq[Char] , and therefore it obeys the bounds view request to be convertible bypass.
I continue to see the shorthand of "ev", especially when it is related to the boundary of the context or the boundary of the view, what does this mean?
This is short for "evidence." If you think about it, when you ask for some implicit parameter that should be in scope, the compiler requires you to confirm that the operation can happen.
source share