comp.lang.ada
 help / color / mirror / Atom feed
From: Andrew Cooke <andrew@andrewcooke.free-online.co.uk>
Subject: Re: disjoint ranges ?
Date: 2000/10/24
Date: 2000-10-24T00:00:00+00:00	[thread overview]
Message-ID: <8t44h8$3ka$1@nnrp1.deja.com> (raw)
In-Reply-To: 39E612C9.9BF98CD3@laas.fr



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 <ptorres@laas.fr> 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.




      parent reply	other threads:[~2000-10-24  0:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-12  0:00 disjoint ranges ? Philippe Torres
2000-10-12  0:00 ` Pat Rogers
2000-10-12  0:00   ` Ehud Lamm
2000-10-12  0:00     ` Pat Rogers
2000-10-13  0:00       ` Ehud Lamm
2000-10-13  0:34       ` Jeff Carter
2000-10-13  0:00         ` Marin David Condic
2000-10-14  3:14           ` Robert Dewar
2000-10-13  0:00         ` Philippe Torres
2000-10-14  3:12           ` Robert Dewar
2000-10-16  0:00             ` Robert A Duff
2000-10-16  0:00               ` Robert Dewar
2000-10-16  0:00               ` Lao Xiao Hai
2000-10-17  0:00                 ` Robert A Duff
2000-10-17  0:00                   ` Lao Xiao Hai
2000-10-18  0:00                   ` dmitry6243
2000-10-18  0:00                 ` Robert Dewar
2000-10-18  0:00                   ` Robert A Duff
2000-10-19  3:08                     ` Overloading "in" (was: disjoint ranges ?) Jeff Carter
2000-10-19  0:00                       ` Ehud Lamm
2000-10-21  0:00                       ` Robert Dewar
2000-10-21  0:00                         ` Jeff Carter
2000-10-13  0:00     ` disjoint ranges ? Philippe Torres
2000-10-13  0:00 ` wayne lydecker
2000-10-13  0:00   ` Lao Xiao Hai
2000-10-23  0:00     ` Charles Hixson
2000-10-24  0:00       ` dmitry6243
2000-10-13  0:00   ` wayne lydecker
2000-10-13  0:00 ` Lao Xiao Hai
2000-10-14  3:17   ` Robert Dewar
2000-10-16  0:00   ` Robert A Duff
2000-10-24  0:00 ` Andrew Cooke [this message]
replies disabled

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