I’d like to further push adoption of the strict-equality feature by making it easier to use. One problem is that many Java standard library types currently don’t have CanEqual instances, and I’d like to fix that by providing them.
The types I’m proposing are: java.util.UUID, java.net.URI, Instant, LocalDate, LocalTime, LocalDateTime, OffsetTime, OffsetDateTime, ZonedDateTime, Year, YearMonth, MonthDay, java.time.Duration, scala.concurrent.duration.Duration (and thereby also FiniteDuration), Period, ZoneId (and thereby also ZoneOffset), DayOfWeek, TimeUnit, Try[A].
A branch with these instances can be found here:
Note that this will also make codebases safer that don’t even use strict-equality, because even with strict-equality disabled, the Scala compiler will prevent you from making a == comparison if one side has a reflective CanEqual instance and the other doesn’t match.
Only in the sense that it would prevent code from compiling that is broken in the first place. When strictEquality is disabled, and a reflexive CanEqual instance is available for one of the sides, then it’ll continue to compile if the other type is a supertype of it, so you can still compare, say, LocalDate to Any. But it won’t allow you to compare LocalDate to Option[LocalDate], and that’s a feature, not a bug.
I misunderstood the system previously !
(I thought a == b and a == (b: Any) would be equivalent)
Therefore I agree the backwards compat issue is unlikely, since it would require an equality which is never satisfied at runtime (or abuse of asInstanceOf)