Tighten rules for implicit conversions - #26668
Conversation
Make use of a given (Scala-3 style) implicit Conversion instance without a `language.implicitConversions` language import a warning in 3.10 and an error in 3.11.
|
Let's put it on next Scala Core's agenda. |
| * given [T] => Conversion[T, Option[T]] = Some(_) | ||
| * ``` | ||
| * As of Scala 3.9, the language still supports Scala-2 style conversions, but these | ||
| * are slated to be phased out. |
There was a problem hiding this comment.
is there a reason why Conversion is so restricted, e.g. poor support for path-dependent types, inline/macro, by-name param - I thought the main point of the new style was only to require the import at use-site (or into) - but as it stands many conversions can't migrate to the new style.
I would say Polymorphic/evidence-requiring conversions are also poorly supported due to requiring allocations/megamorphic dispatch - but i havent done the benchmark,
So to summarise: Why not keep supporting indefinitely the semantics of the old style conversions but under a new definition syntax that requires the same "use-site" rules?
Make use of a given (Scala-3 style) implicit Conversion instance without a
language.implicitConversionslanguage import a warning in 3.10 and an error in 3.11.