(Mostly) Dropping Weak Conformance
Today in Dotty News is another one that has been part of the Dotty plan for a good while, but is now on its way towards a SIP: dropping weak conformance in most cases.
You can find the summary proposal here; the tl;dr is that the language will get less aggressive about trying to squash numeric types together.
Currently, if you have a list comprising various numeric types, the language goes to some effort to figure out the “least common denominator” type, and do automatic conversions to that type, even though that isn’t obviously correct from a type POV.
This sort of thing was the original motivation:
List(1, 2.3, 42.5, 100)
That will still be interpreted as a List[Double]
as you might expect. But only that case — of integer literals being converted to another numeric type — would be retained in the new proposal, and all the other automatic conversions would be dropped.
IMO it’s a net win — it mostly removes a weird bit of magic that doesn’t quite fit with Scala’s usual “be consistent” philosophy, while preserving the exception that people really do use fairly often. But if you want to see the details, or weigh in on the proposal, I recommend checking it out…