comp.lang.ada
 help / color / mirror / Atom feed
From: Lao Xiao Hai <laoxhai@ix.netcom.com>
Subject: Re: Types, subtypes and ranges
Date: Tue, 20 Mar 2001 08:57:05 -0800
Date: 2001-03-20T16:59:19+00:00	[thread overview]
Message-ID: <3AB78BE0.1C2764C7@ix.netcom.com> (raw)
In-Reply-To: 3AB5FA4A.1779F976@earthlink.net



"Marc A. Criley" wrote:

>
> Hmmm, I've never really considered subtypes a "weakening" of the type
> slightly, though obviously they could be ill-used to that end.  My use
> of them has been in fact to tighten up the typing.

Often, some programmer will declare a lot of subtypes to avoid
some of the strict compile-time type checking on operations.  Also,
without the need for explicit type conversions, one can blithely
assign one type to another without considering the implications,
such as potential range constraints at run-time.

Granted, one must confront the same issue with derived types that
have varying ranges, but we could hope the need for explicit type
conversion makes the programmer stop and consider the possible
consequences of that action.

That being said, the examples you have presented are excellent for
demonstrating the intelligent use of subtypes.

Richard Riehle






  reply	other threads:[~2001-03-20 16:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-03  1:00 Questions: WM
2001-03-03  3:30 ` Questions: Robert Love
2001-03-03 11:09 ` Questions: David C. Hoos, Sr.
2001-03-07 23:05 ` Questions: Mark Lundquist
2001-03-08  1:14   ` Questions: Robert A Duff
2001-03-12  7:41   ` Types, subtypes and ranges Anders Wirzenius
2001-03-12 11:57     ` David C. Hoos, Sr.
2001-03-12 16:06       ` Tucker Taft
2001-03-13  6:40       ` Anders Wirzenius
2001-03-12 16:57     ` Scott Ingram
2001-03-18 22:28     ` Lao Xiao Hai
2001-03-19 13:22       ` Marc A. Criley
2001-03-20 16:57         ` Lao Xiao Hai [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-03-14 13:50 Christoph Grein
replies disabled

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