comp.lang.ada
 help / color / mirror / Atom feed
From: Lao Xiao Hai <laoxhai@ix.netcom.com>
Subject: Re: disjoint ranges ?
Date: 2000/10/13
Date: 2000-10-14T01:53:33+00:00	[thread overview]
Message-ID: <39E7BB80.1AB10FE2@ix.netcom.com> (raw)
In-Reply-To: 39E79F17.24DB0828@pacbell.net



wayne lydecker wrote:

> >How about using a boolean array:
>
> with Text_IO;
> procedure lunch is
>   type Hours is new Integer range 0 .. 23 ;
>   Lunch_Hours : array (Hours) of Boolean :=
>     (7..9 => True, 12..14 => True, 19..21 => True, others => False);
> begin
>   if Lunch_Hours(7) then
>     text_io.put_line("Lunch time");
>   else
>     text_io.put_Line("Get back to work");
>   end if;
> end;

This is one of those, "I can find a way to do it in my language," examples.
We can ultimately solve any programming problem in any programming
language (Yes, I exaggerate slightly), but this returns us to the issue of
expressiveness versus expressibility.   Certain languages are more expressive
of certain problems.   They directly map the solution space to the problem
space.

The original post, if I read it correctly, was not concerned with the question,
"Can such and such be accomplished," but rather, "Is there a syntax to
directly express the solution to the given problem?"   Pat Rogers candidly
and succinctly answered, "No."  That was a correct answer.

There are some in the world of object technology who believe that enumerated
types are a bad idea because they are an artifact of an old-fashioned style of
programming.   This same criticism could be leveled at the whole issue of
range constraints.   While the notion of a range constraints was a good one
when first introduced,  it could be argued that the problem addressed by
a range constraint better can  be solved with assertions.  An assertion would
enable easy modeling of non-contiguous ranges.   Of course, this also makes
the compiler a bit more complicated and introduces other problems.  The
question is whether the new problems are worse than the old one being
solved.

I coming to believe more and more that an assertion model, similar to that
in Eiffel, would be a worthwhile capability of the next Ada standard.  At
the same time,  perhaps the new standard should make obsolescent some
of the outmoded ideas(e.g., variant records) that are anachronistic in the
contemporary world of OOP.

Just a little old-fashioned heresy on a warm Saturday evening in California.

Richard Riehle





  reply	other threads:[~2000-10-13  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         ` 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 ? Marin David Condic
2000-10-14  3:14           ` Robert Dewar
2000-10-13  0:00     ` Philippe Torres
2000-10-13  0:00 ` wayne lydecker
2000-10-13  0:00   ` Lao Xiao Hai [this message]
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
replies disabled

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