[PING^2] ada: Add limitations on the acceptable prefixes of 'Old

Samuel Tardieu sam@rfc1149.net
Wed May 7 09:15:00 GMT 2008


On  7/05, Arnaud Charlet wrote:

| > http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00978.html
| 
| These proposed changes are not acceptable for several reasons.
| 
| For one thing, you're completely changing the semantic of 'Old without
| making any update to the documentation.

This is wrong, I am not "completely changing the semantics of 'Old",
I am changing its legality rules.

| More importantly, the limitation you're proposing to add are controversial
| and not acceptable. You raise a few interesting issues, but the patch as
| proposed is clearly not acceptable.

I raise exactly four (numbered) issues. Which one are controversial and need
discussion?

Item 1 is an ICE which clearly needs to be fixed. I guess this part is
ok.

Item 2 ('Old of an "out" mode parameter) makes zero sense and is likely
to be a programming error. "out" parameters can be read since
Ada 95 but doing so before writing them is bogus. Do you have a problem with
this one?

Item 3:

| For example:
| <<
| It is possible to take 'Old on a function, introducing the risk
| of having side effects. Moreover, it means that if F is a function,
| "F'Old = F'Old" is not guaranteed to return True as F will be called
| twice. In fact, it is possible to have any expression before 'Old.
| As 'Old is likely to be used in pragma Assert or pre/post conditions,
| this may increase the risk of side-effects depending on the current
| compilation mode (with or without assertions and checks).
| >>
| 
| The same is true for pragma Assert and other similar pragmas, and is
| not an issue that needs fixing at the language level. People know that
| functions in Ada can have side effect, and we're not going to change that,
| so 'Old is not in the business of trying to disallow this situation.

This is the only possibly controversial issue I can see. Does it make
sense to enable 'Old on functions? Does it have any practical use?

Item 4 ('Old used in a formal default expression) looks just plain bogus
to me. Who would want to write this kind of code and what should it do?



More information about the Gcc-patches mailing list