Hi Martin, I haven't tested it, but that should somehow work.
printObject(tw: TextWriter)(T: PrimitiveType, t: T): TextWriter == { if T has OutputType then tw << t else tw << "<unprintable>"; } printObjects(l: List Object): () == { for x in l repeat printObject(stdout)(avail x); } Does that mean that one cannot access the element? I am pretty sure that your "problem" is a non-problem. And if I remember correctly what we talked about today, then the use of Object in FiniteProduct might involve some "pretend", but that would be local to that domain. Wait a bit until I find some time to actually implement what we have discussed today. Ralf On 04/30/2007 09:03 PM, Martin Rubey wrote: > Dear Christian, Ralf, > > I just realized what sort of problem I had with my code below, and what might > pose a difficulty in future: namely, we cannot "deconstruct" an element of > this > type. More precisely: > > 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; > } > > Multiset(T: Type, L: Tuple T): with { > new: List Object -> %; > get: (i: MachineInteger, %) -> Object; > } == add { > Rep == List Object; > import from Rep; > new(a: List Object): % == per a; > get(i: MachineInteger, x: %): Object == { > X: List Object := rep x; > X.i; > } > } > > works, but, as you can see, we can only "get" an Object, not the element > itself. > > I'm not sure whether this is a problem, however. > > 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