Difference between revisions of "Talk:Covariance and generics case study"
Peter gummer (Talk | contribs) |
|||
Line 3: | Line 3: | ||
The explosion of complex declarations in the generic cases could be defused by declaring new classes. It's similar to how you had to declare new classes to redefine features covariantly. Those new classes would encapsulate the generic parameters, saving clients the trouble of worrying about the generics. | The explosion of complex declarations in the generic cases could be defused by declaring new classes. It's similar to how you had to declare new classes to redefine features covariantly. Those new classes would encapsulate the generic parameters, saving clients the trouble of worrying about the generics. | ||
+ | |||
+ | |||
+ | ---- | ||
+ | I tried doing this and it worked well for routine parameters but broke down with function returns. The functions wanted to return the complex generic class but I couldn't downcast these to the simplified versions. |
Revision as of 07:38, 21 April 2008
--Peter gummer 17:53, 13 April 2008 (PDT) This is a really good comparison!
The explosion of complex declarations in the generic cases could be defused by declaring new classes. It's similar to how you had to declare new classes to redefine features covariantly. Those new classes would encapsulate the generic parameters, saving clients the trouble of worrying about the generics.
I tried doing this and it worked well for routine parameters but broke down with function returns. The functions wanted to return the complex generic class but I couldn't downcast these to the simplified versions.