Any Valhalla experts out there? I was thinking abo...
# random
d
Any Valhalla experts out there? I was thinking about the problem of generic containers which "conditionally" implement interfaces -- for example,
ArrayList
implements
Serializable
, but this has the caveat that the runtime type of elements are actually serializable. Could the specialization mechanism in Valhalla (at least with the spec thus far) support conditionally implementing interfaces? e.g. could we see a feature in the distant future that would support something like
class ArrayList<_specializable T> : List<T>, Serializable _whenever T : Serializable
?
e
It is far-fetched at his moment, but so far the proposed class instantiation mechanism in Valhalla is generic enough for all of this to work. Having said, it is only JVM proposal, so far, so likely you'll have write your own byte-code templater that does this magic you want. I have not seen a proposal to do any like that in the Java language.
👍 1
d
Interesting, thanks.. really just speculating, but glad to hear that some future ideas are not totally out of the question.