From: Ted Dennison <dennison@telepath.com>
Subject: Re: private "subtype"s
Date: 2000/10/09
Date: 2000-10-09T00:00:00+00:00 [thread overview]
Message-ID: <8rt85j$hg7$1@nnrp1.deja.com> (raw)
In-Reply-To: 8rsubg$ka7$1@news-hrz.uni-duisburg.de
In article <8rsubg$ka7$1@news-hrz.uni-duisburg.de>,
sb463ba@l1-hrz.uni-duisburg.de (Georg Bauhaus) wrote:
> package Whoops is -- illegal!
>
> subtype Constr is private;
> -- [[Constr]] is constrained, but the constraints need
> -- not be known outside
>
> private
> subtype Constr is Natural range 0..99;
> end Whoops;
That makes a little bit of sense. After all, if the client doesn't know
that Constr is a subtype of Natural, then what should the compiler do if
the client tries to assign a Constr to an Integer? The most probable
answer is "report an error". But if that's the case, Constr is really no
better to the client than a derived type. If fact, its worse. So why not
just use a derived type and be done with it?
--
T.E.D.
http://www.telepath.com/~dennison/Ted/TED.html
Day 1 of Free Europe
Sent via Deja.com http://www.deja.com/
Before you buy.
next prev parent reply other threads:[~2000-10-09 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-10-09 0:00 private "subtype"s Georg Bauhaus
2000-10-09 0:00 ` Ted Dennison [this message]
2000-10-10 0:00 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox