Given Scala 3's first-class syntax for extension methods, is the complexity of right-associative operators still warranted? Could similar ergonomics be achieved without the magic associativity rule based on a colon in the name? def (x: T) :: (xs: List[T]): List[T] = ::(x, xs)
It's those subtle differences I'm wondering about... How important are they? In reality, I don't see the current setup ever changing. But extension methods (or implicit classes) do provide a way to make any method *look* more like it's right-associative already.
-
-
The subtle differences tend to show up in type inference and its interactions with variance in particular. Types are inferred in a different order with extension methods, which you can exploit to guide the inference, or which can bite you if you want to compute something.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.