comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: array conversion - how to do?
Date: 1997/06/27
Date: 1997-06-27T00:00:00+00:00	[thread overview]
Message-ID: <dewar.867457041@merv> (raw)
In-Reply-To: 33B3DE95.41EF@does.not.exist.com


Geert says

<<> I could imagine why it would not be possible to convert String
> to ASCII_String, since that conversion might need time-consuming
> checks. The conversion in the example is completely safe though,
> which is statically checkable for the compiler.
>>

YOu are trying to introduce into Ada a semantic concept that is 
completely missing at the moment, namely the idea that conversions
should be subdivided into those that may raise CE and those that
are known to be CE-safe at compile time.

Such distinctions are reasonable at the implementation level, but I find
the idea of basing legality on such considerations to be a large and very
unwelcome increase in semantic complexity.

In Ada, a subtype check is needed for a subtype conversion period. If the
compiler can optimize away the check fine. The rules on conversion of
arrays seem entirely consistent with this point of vi9ew.

You worry about writing the loop, but a good compiler should be able to
generate efficient code for that loop. After all the checks will all
get eliminated, and then there is no reason to think the loop will generate
code any different on a typical machine from the conversion.





  reply	other threads:[~1997-06-27  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 [this message]
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
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