comp.lang.ada
 help / color / mirror / Atom feed
From: Geert Bosch <geert@gonzo.sun3.iaf.nl>
Subject: Re: array conversion - how to do?
Date: 1997/06/28
Date: 1997-06-28T00:00:00+00:00	[thread overview]
Message-ID: <5p3rad$8n8$1@gonzo.sun3.iaf.nl> (raw)
In-Reply-To: EACHUS.97Jun27225701@spectre.mitre.org


Robert I. Eachus <eachus@spectre.mitre.org> wrote:
       I used to worry about the fact that doing these conversions
   efficiently meant instantiating Unchecked_Conversion, but I
   eventually came around to the understanding that that is exactly
   what is happening here.

At first I had expected that the conversion would be allowed if the
elements of the source and target array had the same base type. Then
the compiler could add the standard checks for subtype conversion and
eliminate them in cases where the checks are known to succeed, like
in my example for conversion from ASCII_String to String.

The drawback of my generic Array_Conversion is that it is too powerful
in that it can convert an array of A to an array of B as long as B is
a new A. I would like to only allow conversion when A and B are subtype
compatible. Anyway, the point was to avoid copying as happens in the
loop approach, but at least GNAT doesn't seem to do that yet.

Hopefully this will improve with time.

Regards,
   Geert




  reply	other threads:[~1997-06-28  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-24  0:00 array conversion - how to do? Geert Bosch
1997-06-27  0:00 ` Wes Groleau
1997-06-27  0:00   ` Robert Dewar
1997-06-28  0:00     ` Geert Bosch
1997-07-03  0:00       ` Robert Dewar
1997-07-04  0:00         ` Geert Bosch
1997-07-04  0:00           ` Robert Dewar
1997-07-04  0:00         ` Geert Bosch
1997-06-28  0:00 ` Robert I. Eachus
1997-06-28  0:00   ` Geert Bosch [this message]
1997-06-30  0:00     ` Robert I. Eachus
replies disabled

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