raulraja
08/09/2019, 6:06 AM==
and others operators are dispatched to. == is currently a fun called EQEQ
This means we can with a compiler plugin if there are instances of Eq
and Order
and use them instead of the default functions that delegate to the kotlin internals or equals impl.
This will decouple the lang from the inheritance hierarchy on the ordering and equality operators and would allow us to use ==
instead of eqv
since we can dispatch == to a type class instance instead of the data type member for equals.
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in <http://kotlin.internal.ir|kotlin.internal.ir>' type=kotlin.Boolean origin=EQEQ
`
That can be intercepted and replaced by a new invocation that delegates to the instance of the type class first and if not to the EQEQ call. Same interception strategy the KEEP-87 plugin uses to enhance function access value parameters.