I just found this function in the scala library (in the PartiallyOrdered
trait):
def tryCompareTo [B >: A <% PartiallyOrdered[B]](that: B): Option[Int]
I wonder how should I exactly interpret the type bound. According to my research the >:
operator is a lower type bound, and the <%
is a view bound, (What are Scala context and view bounds?). However, when the two operators are combined, how do I read it.
Is it type B
must be a super class of A
, and A
can be viewed as PartiallyOrdered[B]
? (B >: (A <% PartiallyOrdered[B])
, more or less grouped like this)
Or, type B
must be a super class of A
, and B
can be viewed as PartiallyOrdered[B]
? ((B >: A) <% PartiallyOrdered[B]
, more or less grouped like this).
An extra curiosity, can there be more than two operators combined?