"Thomas" <fantome.foru...@free.fr.invalid> wrote in message
> i find it less readable when the pointed object is constant,
> since it is not remembered at the point of the renames, and one could
> think that it can be changed.
> in other words, at the review time we have to check at the source of the
> renames to know if it is constant or not.
With a renames, you *always* have to check the original object, since the
properties specified in the renames are ignored in most cases. You *will*
get in trouble if you pay attention to them. That's one reason for
minimizing the use of renames (if your program can afford a copy, a copy is
almost always safer anyway, and when it isn't you have to avoid aliasing and
thus avoid renames).
> moreover, when the pointed object is variable,
> constant keyword in a renames could mean that the variable could not be
> modified when used with the "constant renames" identifier.
> i understand that it conflicts with the rule: "the constant keyword
> means that the value never changes"
This is a False statement for Ada, (the details are painful), it's true for
elementary types and some others, but not most composite types.
> i suppose that some people already thought about that ...
I don't recall anyone proposing this, but given the way renames works, it
would either be useless or different from everything else.
That's because a rename ignores the properties declared with it and use the
ones of the actual object. In particular, things like subtypes are not used
at all for a rename - even if specified. If you care about those things, you
need to use a constant. :-)
It would have been better if Ada had used some sort of matching rule, but
Ada 83 did not have static matching, and it was too incompatible to
introduce it in Ada 95, and that will not change.
> but i don't understant what kind of pb there can be with the 1st case,
> so i would find nice to have the constant keyword when the pointed
> object is one, even if it stay forbidden in the other case.
No problem, per se, just completely different than the current model of
If you think this is important, you should submit something via the new
Community Input site. (Not announced yet, but should be working - it's in
beta now, so if it fails, we need to know that.) See arg.adaic.org