Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site noscvax.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!ihnp4!qantel!hplabs!sdcrdcf!sdcsvax!noscvax!broman
From: broman@noscvax.UUCP (Vincent P. Broman)
Newsgroups: net.lang.mod2
Subject: large SETs desired
Message-ID: <43@noscvax.UUCP>
Date: Wed, 2-Oct-85 18:11:27 EDT
Article-I.D.: noscvax.43
Posted: Wed Oct  2 18:11:27 1985
Date-Received: Sun, 6-Oct-85 14:49:45 EDT
Distribution: net
Organization: Naval Ocean Systems Center, San Diego
Lines: 38

<> 

Both Pascal and Modula-2 offer simple and useful notations for SETs, with
builtin operators to manipulate them, making a powerful mathematical 
abstraction available in a high-level form.  I use sets often.  Unfortunately, 
the warning that SETs may be restricted by the implementor to base types with 
few (8, 16?) elements, forces me often to replace SETs by ARRAYs of SETs and 
write procedures to manipulate them, in order to write portable code.  This is 
clumsy and detracts much from their notational convenience.  

I would suggest that rule 2 on page 65 of PIM2 end approximately as follows:

       "2. ... set a limit to the number of elements admissible in base types.  
       This should be no more restrictive than memory or segmentation 
       considerations necessitate. In any case, base types of up to N (256?) 
       elements shall be supported." 

Supporting larger SETs in the compiler would probably require that some SET 
operations be realized as single machine instructions, others as subroutine 
calls. This is a reasonable price to pay to make SET types machine 
independent.  

Wirth slipped a bit when he said on the page (65) mentioned above, that "set 
types are a powerful tool ... to express operations on individual bits of an 
operand ...." Actually, the BITSET is the low-level tool used to manipulate 
bits on your machine.  The user-defined SET types implement the high-level 
concept of a mathematical set, and if they are mapped into bit operations by 
the compiler, that fact has little relevance to how I should use them.  
Even on a decimal machine BITSET may disappear, but I would expect user-defined
SETs to work.

Hurray that Modula-2 has SETs.  Among the pile of features pasted onto Ada, 
this important one seems to have been left out.

Vincent Broman   (619) 225-2365      MILNET: broman@nosc
Analysis Branch, code 632            UUCP: {ihnp4,decvax,akgua,dcdwest,
Naval Ocean Systems Center               allegra,ucbvax}!sdcsvax!noscvax!broman
San Diego, CA  92152                 ICBM: 32deg 42min N / 117deg 14min W