Re: [ooc-compiler] libadt: Naming Issues
Brought to you by:
mva
|
From: Stewart G. <gre...@mu...> - 2000-09-08 14:47:17
|
"Griebling, Michael" wrote: > > I'm not sure whether this would solve any problems but > languages such as Ada which support generic interfaces > through which a data type could be supplied during > instantiation. This would at least take care of the > need to subclass based on different types. Someone > was working on a method of doing something like this > with one of the Oberon dialects but I can't recall > which one it was. Yes. I agree. Without generics (or parametric types), collections or other abstract data types must be framed in terms of a universal type. In Java (for example), its impossible to define a Set of X, or a Mapping from A to B within the standard framework. The framework defines Set of Object, and Mapping from Object to Object. Since everything sub-types Object, any object can participate in these data structures, but there is no static guarantee of the type of the members of these collections. This means lots of (unnecessary) type guards in client code. Roe and Szyperski proposed parametric polymorphism for Oberon: http://www.fit.qut.edu.au/~szypersk/pub/JMLC97.ps.gz I'm not sure if anyone actually implemented it. Both Oberon Microsystems and the QUT team have stated their intentions to support it in their Component Pascal implementations. Actually, its probably not that hard to support a limited generics facility using the technique outlined in Roe and Szyperski's paper. It requires no change to the Oberon run-time system, just a re-interpretation of the type rules for pointers. Combined with interfaces and/or compound types, this could be very powerful. Cheers, Stewart |