Maybe the following piece of code is interesting. If one wraps "element" thick enough, one can use dependent types. Aldor does not realize though that getit(OutputType, ...) has OutputType.
#include "aldor" #include "aldorio" Object: with { object: (T: PrimitiveType, T) -> %; avail: % -> (T: PrimitiveType, T); } == add { Rep == Record(T: PrimitiveType, val: T); import from Rep; object (T: PrimitiveType, t: T) : % == per [T, t]; avail (ob: %) : (T: PrimitiveType, T) == explode rep ob; } ------------------------------------------------------------------ getit(T: Category, L: Tuple T, i: MachineInteger): T == add { import from Tuple T; element(L, i); } MyTuple(T: Category, L: Tuple T): with { new: List Object -> %; get: (i: MachineInteger, %) -> getit(T, L, i); } == add { Rep == List Object; import from Rep; new(a: List Object): % == per a; get(i: MachineInteger, x: %): getit(T, L, i) == { X: List Object := rep x; (U, u) == avail(X.i); u pretend getit(T, L, i); } } ------------------------------------------------------------------ import from Integer, Object, List Object, Boolean, MachineInteger; t: Tuple OutputType == (Integer, Boolean); li : List Object := [object(Integer, 17), object(Boolean, true)]; m: MyTuple(OutputType, t) == new li; p: getit(OutputType, t, 1) := get(1, m)$MyTuple(OutputType, t); stdout << p pretend Integer << newline; -- note that the following results in an "export not found": -- if getit(OutputType, t, 1) has OutputType -- then stdout << p << newline; ------------------------------------------------------------------ all the best, Martin ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Aldor-combinat-devel mailing list Aldor-combinat-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aldor-combinat-devel