This has nothing to do with with familiarity, it has to do with consistency (and to a lesser effect orthogonality)
You can do this right now
implicit class MyOrderingListOps[T](xs: List[T])(implicit ord: Ordering[T]) {
def myMax = ???
}
And you can call it just like normal, i.e.
List(1,2,4).myMax
Then you are passing the environment into the max
function and you get all of the properties (as you describe). If you want to the above explicitly, you would do
new MyOrderingListOps(List(1,2,4))(ordering)).max
Which is semantically equivalent to what you mentioned, i.e.
This is what I mean when I talk about consistency, because this is completely consistent with how the language Scala works, and this is the beauty of having something that is orthogonal, depending on where you place the implicit
you can control how application works; we don’t need to invent a new language construct, we can already do this! This doesn’t need a new language construct, its already possible.
And the final point is we should have control over this because as you pointed out there is a difference between applying the environment (in this case the Ordering
) curried before the application of x
and y
versus after. Creating an entirely new language construct just to do this is overkill, to say the least.
And yes I am aware that the implicit class
syntax will get replaced with extension methods, but it should work in the same manner.