comp.lang.ada
 help / color / mirror / Atom feed
* Re: Pascal type sets in Ada?
@ 1992-09-21 13:03 dog.ee.lbl.gov!hellgate.utah.edu!caen!zaphod.mps.ohio-state.edu!cis.ohio-
  0 siblings, 0 replies; 2+ messages in thread
From: dog.ee.lbl.gov!hellgate.utah.edu!caen!zaphod.mps.ohio-state.edu!cis.ohio- @ 1992-09-21 13:03 UTC (permalink / raw)


In article <1992Sep21.050905.1@cc.utah.edu> eyring@cc.utah.edu writes:
>This is a question I have had for some time.
>Why doesn't Ada include Pascal type sets?
>There must be a reason.  Or how does one 
>do Pascal sets in Ada?  Any ideas?

The reason we omitted the Pascal "SET OF" type constructor is that
we believed set types could be defined using the other features of
the language.  As to how, the Ada Rationale, Sect 12.2.4, gives a
miniature example.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Pascal type sets in Ada?
@ 1992-09-21 17:26 Jame s Crigler
  0 siblings, 0 replies; 2+ messages in thread
From: Jame s Crigler @ 1992-09-21 17:26 UTC (permalink / raw)


In article <1992Sep21.050905.1@cc.utah.edu> eyring@cc.utah.edu writes:
>This is a question I have had for some time.
>Why doesn't Ada include Pascal type sets?
>There must be a reason.  Or how does one 
>do Pascal sets in Ada?  Any ideas?
>-- 
>>Bob Witmer

I think Booch discusses this (or something simalar) in _Software_Engineering_
In_Ada (my least favorite Ada book).  The essence is to create a generic
that defines a set to be a BOOLEAN array, then use pragma PACK to lower the
space overhead.

E. g.:

generic
  type BASE is (<>);
package SET_PKG is 
  type SET_TYPE is array (BASE) of BOOLEAN;
  pragma PACK (SET_TYPE);
  function "+" (S : SET_TYPE; I : BASE) return SET_TYPE;  -- Add a member
  function "-" (S : SET_TYPE; I : BASE) return SET_TYPE;  -- Remove a member
  function IS_A_SUBSET (S : SET_TYPE; POTENTIAL : SET_TYPE) return BOOLEAN;
  function IS_A_MEMBER (S : SET_TYPE; I : BASE) return BOOLEAN;
  ...
end SET_PKG;

Jim Crigler
----------------------------------------
Guinan is Q's mother.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1992-09-21 17:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-09-21 17:26 Pascal type sets in Ada? Jame s Crigler
  -- strict thread matches above, loose matches on Subject: below --
1992-09-21 13:03 dog.ee.lbl.gov!hellgate.utah.edu!caen!zaphod.mps.ohio-state.edu!cis.ohio-

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox