Hi everyone,
I’m exploring whether Scala could take advantage of some ideas around optimizing generics without needing full specialization :
https://mail.openjdk.org/pipermail/valhalla-spec-observers/2025-March/002524.html
I recently sent a message to the Valhalla spec observers mailing list about a possible use of value classes to optimize erased generics on the JVM. The core idea is:
Even with type erasure, the JVM could store value class instances without indirection—if it knows the erased type at runtime is a value class.
This would avoid the need for full parametric class specialization, and could provide some benefits today without requiring the full Parametric JVM model to be in place.
No replies on the list so far, but I’m wondering if anyone here—especially folks working on Scala 3 or the compiler—has thoughts on whether this approach could be leveraged by Scala
Would love to hear thoughts
Best,
Diego Rosario