Add EnumMap.keyType() and EnumSet.elementType()

Andrej Golovnin andrej.golovnin at gmail.com
Sat Dec 9 18:29:02 UTC 2017


Hi Rémi,

> It's like exposing reified type arguments, i can see these kind of change back firing in at least two ways.
> It's not future proof, part of valhalla requires to change generics to allow generics of value types which requires a form of reification, but we may end up with a light form of reification similar to Scala type manifest (type arguments are available at construction time but not after that point) exposing type arguments for EnumSet will be seen as a mismatch in that case. Also, we may want to introduce unmodifiable EnumSet in the future, currently an unmodifiable empty EnumSet do not need to store any type argument, the proposed API force us to have as many empty EnumSet as type arguments combination (it's why you have one static field by type specialization in C#), again it makes the proposed API not future proof.

Only the death is future proof. Everything else is debatable. (c) :-P
Empty EnumSet is not a problem. As I already said there is a workaround
(an ugly one, but it is there). The real problem is an empty EnumMap.
When the valhalla project would provide a solution to my problem, then
I’m fine with it. When not, then let us debate about an alternative solution. :-)

Best regards,
Andrej Golovnin 


More information about the core-libs-dev mailing list