Archive for December 2010
Imitation of Java Generics
Posted 31/12/2010
on:- In: techniques
- 6 Comments
Generic programming is very common and has different names (and features) in various programming languages; C++ provides Turing-Complete Templates, Java offers Generics (along with Ada, Eiffel, C#, and Visual Basic .Net), and Parametric Polymorphism is present in ML, Scala, and Haskell.
While I am generally pretty happy with what C++ has to offer, adopting some of the features offered by other mechanisms can come in handy sometimes. To be more specific, in this post we will mimic Java’s support for defining an upper bound for generic elements (i.e. List<T extends Comparable>).
Recent comments