comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: pragma Pure (Ada)
Date: Fri, 7 Oct 2011 20:08:40 -0500
Date: 2011-10-07T20:08:40-05:00	[thread overview]
Message-ID: <j6o7qq$3s8$1@munin.nbi.dk> (raw)
In-Reply-To: op.v2nigzdfule2fv@index.ici

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2340 bytes --]

"Yannick Duch�ne (Hibou57)" <yannick_duchene@yahoo.fr> wrote in message 
news:op.v2nigzdfule2fv@index.ici...
Le Sat, 01 Oct 2011 03:50:36 +0200, Yannick Duch�ne (Hibou57)
<yannick_duchene@yahoo.fr> a �crit:

>> In "A Brief Introduction to Ada 2012" (a great paper from John Barnes) ->
>> http://www2.adacore.com/wp-content/uploads/2006/03/Ada2012_Rational_Introducion.pdf
>
>On page 14
>
>> However, the behaviour of components which are records
>> is different in Ada 2005 according to whether they are
>> tagged or not. If a component is tagged then the primitive
>> operation is used (which might have been redefined),
>> whereas for an untagged type, predefined equality is used
>> even though it might have been overridden. This is a bit
>> surprising and so has been changed in Ada 2012 so that all
>> record types behave the same way and use the primitive
>> operation.
>
>Not talking for me, but potentially for others: this may possibly 
>introduce surprising behaviors in ancient applications, isn't it ?

Right, although in most cases the change will fix bugs rather than create 
them. [Someone at AdaCore ran a testing version of GNAT with added code to 
identify such cases -- all of the code that was found either was test 
programs created specifically to check for the Ada 83/95 behavior, or cases 
where the programmer expected "=" to compose (but it didn't). They found no 
examples of cases where code actually expected non-composition of "=".]

There also are some new legality rules, but those of course could only cause 
an old program to be rejected. (Which would easily be fixed by moving the 
offending "=" declaration to some visible place.) So these are much less 
concerning.

We spent a lot of effort trying to figure out a way to keep compatibility 
for old code, but in this case it always came back to the fact that 
composition of "=" is what is really intended, and any hack to support both 
makes little sense (no one would intentionally want "=" to not compose).

Thus we eventually decided that it was better to just make the change.

                             Randy.


-- 
"Syntactic sugar causes cancer of the semi-colons."  [Epigrams on
Programming - Alan J. - P. Yale University]
"Structured Programming supports the law of the excluded muddle." [Idem]
Java: Write once, Never revisit 





  reply	other threads:[~2011-10-08  1:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-01  1:50 pragma Pure (Ada) Yannick Duchêne (Hibou57)
2011-10-01  2:11 ` Yannick Duchêne (Hibou57)
2011-10-08  1:37   ` Adam Beneschan
2011-10-08 22:54     ` Yannick Duchêne (Hibou57)
2011-10-09  6:34       ` Niklas Holsti
2011-10-10 15:06       ` Adam Beneschan
2011-10-01  2:28 ` Yannick Duchêne (Hibou57)
2011-10-08  1:08   ` Randy Brukardt [this message]
2011-10-08 23:00     ` Yannick Duchêne (Hibou57)
2011-10-01  3:09 ` Adam Beneschan
replies disabled

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