Pre-SIP derives clauses for opaque types

I couldn’t explain it, but for me
opaque type USD derives Show = Int
looks weirder than
opaque type USD = Int derives Show

I think it also has the advantage of going well with bounds:
opaque type USD <: Number = Int derives Show
vs
opaque type USD derives Show <: Number = Int
or
opaque type USD <: Number derives Show = Int

I agree that the via mechanism is a bit unexpected, but if it behaves intuitively enough for users not having to worry about it, it is not such a concern

4 Likes