comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst@cts.com>
Subject: Re: enumration using integers?
Date: 20 Apr 2001 08:50:55 -0700
Date: 2001-04-20T08:50:55-07:00	[thread overview]
Message-ID: <yecd7a7sh7k.fsf@king.cts.com> (raw)
In-Reply-To: 3AE04917.DF97BEA0@emw.ericsson.se

Sven Nilsson <emwsvni@emw.ericsson.se> writes:
> Ted Dennison wrote:
> > Hmm. I don't see anything in the above that couldn't have been done
> > by making Distance a sybtype of Integer. Are you saying that you
> > just want an integer type
> > with "holes" in it, so that
> > Dist := 2;
> > would raise a Constraint_Error?
> 
> Yepp, that sounds about right. I've been looking for something like that
> in Barnes but I couldn't find it... Any clue?
> 
> -Sven

Declare your own private type with the desired characteristics.  You
can overload whatever arithmetic operations you need.  You don't get
numeric literals, but you can overload unary "+" to convert from
Integer.

(The language doesn't have *everything* built in.)

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Cxiuj via bazo apartenas ni.



  reply	other threads:[~2001-04-20 15:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-19 10:58 enumration using integers? Sven Nilsson
2001-04-19 12:42 ` Marc A. Criley
2001-04-19 13:02 ` Philip Anderson
2001-04-19 14:50 ` Ted Dennison
2001-04-20  5:22   ` Sven Nilsson
2001-04-20 13:57     ` Ted Dennison
2001-04-20 14:35       ` Sven Nilsson
2001-04-20 15:50         ` Keith Thompson [this message]
2001-04-20 18:18         ` Ted Dennison
2001-04-20 15:52     ` Samuel T. Harris
replies disabled

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