comp.lang.ada
 help / color / mirror / Atom feed
From: Paul Graham <pgraham@cadence.com>
Subject: Re: Why is it Called a Package?
Date: 2000/04/07
Date: 2000-04-07T00:00:00+00:00	[thread overview]
Message-ID: <38EE12F4.7972A964@cadence.com> (raw)
In-Reply-To: 8ck2mt$jrn$1@clnews.edf.fr

Pascal Obry wrote:
> I don't think we want that. A very nice consequence here is that you can
> easily change an abstraction from:
> 
>    package P is
>       Some_Value : array (1 .. 10) of Integer;
>       --  first quick implementation using basic array
>    end P;
> 
> to
> 
>    package P is
>       function Some_Value (N : in Positive) return Integer;
>       --  real implementation using a complex structure
>    end P;
> 
> (or the other way around) without modifying all client code.

What about:

    x := Some_Value(1 .. 3);

Changing the implementation from an array to a function is not so easy
here.

If for efficiency reasons you want to re-implement a function as an
array lookup, why not just write a public function as an interface to a
private array, then inline it?

I've always thought that using [] for indexing, slicing, and aggregates
would have made the language much simpler.  How many times have you Ada
experts had to explain to someone that (1) is not a legal array
aggregate?

Another thing that has always bothered me is the omission of parentheses
in a subprogram without arguments.  It results in some peculiar corner
cases in the language.  For instance, sometimes f.x means variable x
declared within function f, and sometimes it is a call to f returning a
record (or an access to record :-) with element x selected.  And I seem
to remember some ambiguities with attributes of sbprograms: is
f'some_attribute an attribute of the function f or of the value returned
by f.  Sure, the LRM has rules to resolve these ambiguities, but why
introduce the ambiguities in the first place?
 
Paul




  parent reply	other threads:[~2000-04-07  0:00 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-27  0:00 Why is it Called a Package? Gary Scott
2000-03-27  0:00 ` Ted Dennison
2000-03-27  0:00 ` Nick Roberts
2000-03-27  0:00   ` Robert A Duff
2000-03-29  0:00     ` Florian Weimer
2000-03-29  0:00       ` Robert A Duff
2000-03-30  0:00         ` Geoff Bull
2000-03-30  0:00           ` Robert A Duff
2000-03-30  0:00             ` Jean-Marc Bourguet
2000-03-30  0:00               ` David Starner
2000-04-03  0:00               ` Robert A Duff
2000-04-06  0:00             ` Brian Rogoff
2000-04-07  0:00               ` Pascal Obry
2000-04-07  0:00                 ` Samuel T. Harris
2000-04-07  0:00                   ` Richard D Riehle
2000-04-08  0:00                     ` Florian Weimer
2000-04-09  0:00                       ` Stefan Skoglund
2000-04-07  0:00                   ` Brian Rogoff
2000-04-08  0:00                     ` Robert A Duff
2000-04-07  0:00                   ` Stanley R. Allen
2000-04-07  0:00                 ` Paul Graham [this message]
2000-04-07  0:00               ` Robert A Duff
2000-04-07  0:00                 ` Brian Rogoff
2000-04-07  0:00                   ` Robert A Duff
2000-04-08  0:00                     ` Brian Rogoff
2000-04-07  0:00               ` Robert Dewar
2000-04-07  0:00                 ` Brian Rogoff
2000-04-07  0:00                   ` Hyman Rosen
2000-04-07  0:00                     ` Brian Rogoff
2000-04-12  0:00                 ` Comment from the trenchs Robert Brantley
2000-04-13  0:00                   ` Jeff Carter
2000-04-17  0:00                     ` Robert Brantley
2000-03-28  0:00   ` Why is it Called a Package? Ken Garlington
2000-03-28  0:00   ` Jean-Marc Bourguet
2000-03-28  0:00     ` Robert A Duff
2000-03-30  0:00     ` Alfred Hilscher
2000-03-31  0:00       ` Anders Wirzenius
2000-03-29  0:00   ` Florian Weimer
2000-03-27  0:00 ` Larry Kilgallen
2000-03-27  0:00   ` Robert A Duff
2000-03-28  0:00     ` Gary Scott
replies disabled

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