The boxing of primitives only happens if you use the generics. It can easily be avoided with, for example,
trait NewIntType:
opaque type Type = Int
def apply(a: Int): Type = a
extension (a: Type) def value: Int = a
end NewIntType
The boxing of primitives only happens if you use the generics. It can easily be avoided with, for example,
trait NewIntType:
opaque type Type = Int
def apply(a: Int): Type = a
extension (a: Type) def value: Int = a
end NewIntType