comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Ragged Array Proposal
Date: 1999/09/25
Date: 1999-09-25T00:00:00+00:00	[thread overview]
Message-ID: <7sijl6$ta0$1@nnrp1.deja.com> (raw)
In-Reply-To: 37ebb120@eeyore.callnetuk.com

In article <37ebb120@eeyore.callnetuk.com>,
  "Nick Roberts" <nickroberts@callnetuk.com> wrote:

> Fruits: constant array (Positive range <>) of Unbounded_String
:=
>     (To_Unbounded_String("Apple"),
>      To_Unbounded_String("Orange"),
>      To_Unbounded_String("Pear"),
>      ...);
>
> This technique suffers from the same heavy syntax of the
allocator
> technique,

Well as I noted in an earlier message, the "light" syntax of
C hides a lot of sins, it is always puzzling to people who
are using C at first, that they cannot declare the Fruits
array as in our example, and then say


   if (Fruits [j] == "abc") ...

of course they *can* say it, it is perfectly legal and well
defined in C, it just does not do what the programmer expects
(generally the result will be false).

If you really get so upset by reading To_Unbounded_String, then
replace it with a unary "+" as in my previous example (I
actually wanted the unary "+" in the standard here, but
that proposal did not attract enough support). Indeed both
Jean Ichbiah and I have always liked the idea of using unary
plus as a quietish, but still explicit, conversion operator,
and we both pushed for adding one extra unary operator (obvious
choice the pillow or currency conversion symbol) which would
have no predefined meaning, but would be specifically intended
as a conversion operator of this kind, but that again did not
attract enough support.

> and while it saves having to explicitly declare an access
> type, it's almost certain to have an implementation that
> involves dynamic allocation (together with the further baggage
> of a controlled type).

Sure, but you would be surprised what a large percentage of
string processing stuff is quite happy with such overhead
(think of SPITBOL, and even Java).

> A very clever optimiser might be able to perform
> pre-allocation (as mentioned in
> other posts in this thread), but I suspect that most Ada
compilers, in
> reality, would not.

Waste of time I would think ...


Robert Dewar


Sent via Deja.com http://www.deja.com/
Before you buy.




  parent reply	other threads:[~1999-09-25  0:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <37e7c08e@eeyore.callnetuk.com>
1999-09-22  0:00 ` Ragged Array Proposal Ted Dennison
1999-09-22  0:00   ` Ray Blaak
1999-09-23  0:00     ` Ted Dennison
1999-09-23  0:00     ` Tucker Taft
1999-09-23  0:00       ` Nick Roberts
1999-09-23  0:00         ` Hyman Rosen
1999-09-24  0:00           ` Nick Roberts
1999-09-24  0:00             ` Hyman Rosen
1999-09-25  0:00               ` Robert Dewar
1999-09-27  0:00                 ` Hyman Rosen
1999-09-27  0:00                   ` Brian Rogoff
1999-09-28  0:00                   ` Robert Dewar
1999-09-24  0:00         ` Ted Dennison
1999-09-24  0:00           ` Nick Roberts
1999-09-24  0:00         ` Robert Dewar
1999-09-24  0:00           ` Wes Groleau
1999-09-25  0:00             ` Robert Dewar
1999-09-25  0:00             ` Robert Dewar
1999-09-24  0:00       ` Robert Dewar
1999-09-24  0:00     ` Robert Dewar
1999-09-23  0:00 ` Robert I. Eachus
1999-09-24  0:00   ` Nick Roberts
1999-09-25  0:00     ` Robert Dewar
1999-09-25  0:00     ` Robert Dewar
1999-09-25  0:00     ` Robert Dewar [this message]
1999-09-27  0:00     ` Ted Dennison
1999-09-27  0:00       ` Pascal Obry
1999-09-28  0:00         ` Ted Dennison
1999-09-28  0:00           ` Robert Dewar
1999-09-29  0:00             ` Geoff Bull
1999-09-28  0:00       ` Robert Dewar
replies disabled

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