Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site greipa.UUCP Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!decvax!decwrl!greipa!paul From: paul@greipa.UUCP (Paul A. Vixie) Newsgroups: net.lang.mod2 Subject: Re: large SETs desired Message-ID: <404@greipa.UUCP> Date: Thu, 10-Oct-85 03:58:49 EDT Article-I.D.: greipa.404 Posted: Thu Oct 10 03:58:49 1985 Date-Received: Sun, 13-Oct-85 04:07:01 EDT References: <43@noscvax.UUCP> <12107@rochester.UUCP> <1982@reed.UUCP> Reply-To: paul@greipa.UUCP (Paul A. Vixie) Distribution: net Organization: Genstar Rental Electronics, Palo Alto, Ca. Lines: 41 Summary: allow SET OF CHAR In article <1982@reed.UUCP> bart@reed.UUCP (Bart Massey) writes: >As per the size of the sets, it seems reasonable to insist that compilers >support sets of (bits/byte)*(largest value that fits in a WORD) elements. >This is enough to support any reasonable use, and is still efficient >to index... Let's see... for a VAX, that's (8) * (2**32) This may seem efficient to index, but to me that's still alot of bits. Even so, I agree with this. A feature I used heavily when writing non-portable Pascal was constant SET OF CHAR expressions out in the code... thus if (ch = 'e') or (ch = 'q') or (ch = 'x') then ... was often written if (ch in ['e', 'q', 'x']) then ... . This was more efficient AND more legible, a rare combination. Wirth decided to limit sets to having no more elements than a WORD has bits because everybody implements sets with bit strings (anybody besides me remember when we used to multiply primes together?), and it's easier to check the status of a bit if you know in advance what byte it's in. But for the additional readability, I'd prefer a compiler smart enough to generate the extra code for manipulating sets larger than a WORD can handle. It won't be efficient, but sets that size would not often be used by system programmers, so the "usual" case (small sets) loses nothing. Even system programmers need large bit strings once in a while. Cached allocation maps for mass storage devices, for example. Will high-level Modula code for selecting an element out of an ARRAY OF BITSET be as efficient as compiler-generated code for SET OF [0..999999] ? I think not. -- Paul Vixie {decwrl dual pyramid}!greipa!paul