The review is really helpful! Thank you, that had to take a long time to assemble.
For the time being, I strongly object this proposal, and I would like to attempt and restate my objections in a concise manner:
-
I have the feeling that this proposal will create a point of no return for
given
s, which are in my opinion extremely experimental and controversial, and I have many reservations to them (expressed in other discussions). -
Even if we accept
given
s, this proposal introduces a newConversion
trait / class with its own unique semantics. Introduction of “special traits” seem to me as a step towards irregularity of the language, and the more special the semantics of such traits are, the more irregular the language becomes. For further discussion on this – which started as a response to this comment – see this thread. -
IIUC, the unique semantics of
Conversion
are extremely powerful and significantly differ from the rest of given instances; that is, it is (a) applied without bounds, and (b) applied without an explicit method invocation. I believe this will only introduce further confusion into the semantics of implicits / givens.
For these reasons, I believe conversions deserve their own distinct construct.
I like this idea.
I would also like to have an option for extensions to be expressed as a single stateless instance, which is somewhat equivalent to having an object
with the same extension methods, but with the specific instance given as a special parameter (like self
in Python). If I’m not mistaken, opaques are planned to be implemented with such “singleton extensions”?
I’m not sure this could be expressed with conversions though.