[PRL] the "success" of types
John Clements
clements at brinckerhoff.org
Fri May 19 16:05:00 EDT 2006
On May 19, 2006, at 12:49 PM, Matthias Felleisen wrote:
>
> 2. There are two major industrial type systems that are safe/sound:
> Java and C#. These also use parametric polymorphism.
Would it be petty of me to point out that the parametric polymorphism
in Java (a.k.a. Generics) can't be used (AFAIK) usefully in
invariants, only at function calls?
That is, to the best of my knowledge I can't write an invariant that
states:
Right now, x and y are both lists of some type T (though at other
times they might not be of the same type).
... whereas I _can_ write
This procedure accepts two lists that must both contain the same type T.
(I'm not sure, with type erasure in Java 1.5, whether I can encode
the former using the latter. In fact, I'm pretty sure I can't.)
This suggests to me that the "success story" of parametric
polymorphism in Java can be applied only as long as you eschew the
imperative style.
John
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
Url : https://lists.ccs.neu.edu/pipermail/prl/attachments/20060519/b66b6ca6/smime.bin
More information about the PRL
mailing list