Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!julius.cs.uiuc.edu!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!unido!opal!db0tui11!kinderma From: KINDERMA@tubvm.cs.tu-berlin.de (Carsten Kindermann) Newsgroups: comp.lang.eiffel Subject: Class Grouping Message-ID: <90338.181137KINDERMA@DB0TUI11.BITNET> Date: 4 Dec 90 16:11:37 GMT Organization: Technical University Berlin Lines: 49 I am interested in constraining a formal generic parameter of a class definition to more than a single class type. As an illustration consider the (overly simplified) implementation of a frame-like knowledge representation system: FRAMEs have SLOTs, and the value of a SLOT is a list of either FRAMEs, INTEGERs, or STRINGs. The problem now is to group the three classes FRAME, INTEGER, and STRING together to get a single class SLOT-VALUE-LIST. SLOT-VALUE-LIST would then be a descendent of LIST, and might additionally be a sorted list. My question thus is: Is there any way to express in Eiffel that SLOT-VALUE-LIST[T] does not hold list elements of any type T, but that T must be exactly one of FRAME, INTEGER, STRING. I could currently think of two solutions: (1) Constraining a formal generic parameter by a list of allowable Class_types. class SLOT-VALUE-LIST [T-> [FRAME,INTEGER,STRING] ] ... This seems not to be allowed in Eiffel 2.2, but actually is, I guess, what I am looking for. (2) Defining SLOT-VALUES, a common super-class of FRAME, INTEGER, STRING. Defining this class, however, would make it necessary to define MYINTEGER (I assume the basic class INTEGER must not be defined as a descendent of a user-defined class :-) ), but then the INTEGER slot-val- ues would become objects rather than constants. Thus, is there any way to do "class grouping" (I think that is how it is called in the semantic data model area) in Eiffel? If not, how would you solve the problem? Or maybe, could somebody just give the reasons, *why* class grouping is not/cannot be included into Eiffel? Thanks, Carsten Kindermann. ------- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Carsten Kindermann TU Berlin, Projekt KIT-BACK kinderma@tubvm.cs.tu-berlin.de Sekretariat FR 5-12 or kinderma@db0tui11.BITNET Franklinstrasse 28/29 Tel.: +49-30/314 24944 D - 1000 Berlin 10 Fax.: +49-30/314 24929 Brought to you by Super Global Mega Corp .com