[Mono-list] C# changes

Michel Dagenais michel.dagenais@polymtl.ca
11 Nov 2002 09:48:40 -0500


> Generics = polymorphism or parametric polymorphism in functional
> languages.

Like templates in C++ or generic modules/intefaces in Modula-3.
Interestingly, it looks like it will come out about at the same time as
the long awaited Java generics.

> Partial types = one type does not have to be defined in just one file

The only other example I know of partial types is in Modula-3. You have
something like:

(* Interface *)
TYPE 
  HashTable <: HashTablePublic;
  HashTablePublic = OBJECT METHODS
    (* all public methods here *)
  END;
END;

(* Implementation *)
REVEAL
  HashTable = HashTablePublic OBJECT
    (* All the private fields and methods *)
  END;
END;

This allows you to have the public part really visible to the outside
and the rest to remain "opaque". There are other more sophisticated uses
where each module adds a layer of functionality to an object. IMHO from
the Modula-3 experience it is a very elegant feature but which takes
quite a bit of time to grasp for many newcomers. It poses some
implementation challenges as well since the offset of fields and methods
is not known until all revelations have been seen for a type with
partial declarations.