From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8276b2994037cd71 X-Google-Attributes: gid103376,public From: Andrew Cooke Subject: Re: disjoint ranges ? Date: 2000/10/24 Message-ID: <8t44h8$3ka$1@nnrp1.deja.com>#1/1 X-Deja-AN: 685232937 References: <39E612C9.9BF98CD3@laas.fr> X-Http-Proxy: 1.0 x61.deja.com:80 (Squid/1.1.22) for client 62.255.239.196 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Tue Oct 24 13:58:04 2000 GMT X-MyDeja-Info: XMYDJUIDacooke Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.7 [en-gb] (WinNT; U) Date: 2000-10-24T00:00:00+00:00 List-Id: I've just read the discussion following this article after it was recommended as interesting at http://lambda.weblogs.com/ I know the following is a "but my language can do it" post, and that many people here may already know the following, but I was surprised that no-one mentioned that this kind of thing is possible in Lisp and I wondered if knowing how Lisp works would help suggest an acceptable semantics for Ada. Anyway, if you're interested, (Common) Lisp specifies types using "type specifiers". I'm no Lisp expert, but these appear to be expressions that test for type membership - either simple expressions or lists. For more information see http://www.lisp.org/HyperSpec/Body/sec_4-1.html I suspect this would be a huge change to Ada (I guess it does not have type specifiers). And I have no idea how they make it efficient (but Lisp seems to be pretty good at producing elegant ideas that are also efficient)... Andrew PS Sorry if this is such a crap post it's embarassing, Ehud ;-) In article <39E612C9.9BF98CD3@laas.fr>, Philippe Torres wrote: > A very dumb question but i can't find the right syntax so here i am. > How can i declare a type or subtype with a disjoint range ? > > Example : > > If i declare : > --- > type Hours is new Integer range 0 .. 23 ; > -- > i would like a > --- > subtype Lunch_Hours is Hours range 7..9 & 12..14 & 19..21 ; > --- > I know this syntax is totally incorrect but i would like to avoid > enumerations since : > > 1- enumeration types don't accept elements named as numeric literals. I > can't define : type Lunch_hours is (7,8,9,12,13,...); > > 2- if my range are big, i am in trouble. > > Does someone have an idea ? > > Thanks in advance > Philippe > Sent via Deja.com http://www.deja.com/ Before you buy.