comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Basic issue with dotted notation and tagged types
Date: Mon, 22 Oct 2012 10:02:16 +0200
Date: 2012-10-22T10:02:16+02:00	[thread overview]
Message-ID: <1iwm9zh3ctl5y$.197u4rcmyrxyh$.dlg@40tude.net> (raw)
In-Reply-To: k62tl7$cro$1@dont-email.me

On Mon, 22 Oct 2012 09:46:49 +0200, J-P. Rosen wrote:

> Le 22/10/2012 00:55, Yannick Duchêne (Hibou57) a écrit :
>> [Snip]
>> Will this display `A` or `B`? Actually, the program compiled with GNAT
>> 4.6, displays `A`. It displays the same even when the two commented
>> lines are commented‑out and thus the function `F` is declared before the
>> field `F`. I can't remember if the RM have special wordings about it,
>> but I feel this does not honour the principle of least surprise. May be
>> this should be disallowed, to access any one of the two, when both are
>> together visible from a scope?
>> 
> RM2005 4.1.3 (9.2/2): "The designator of the subprogram shall not be the
> same as that of a component of the tagged type visible at the point of
> the selected_component."
> 
> BTW, this corresponds to /my/ view of least surprise: a prefixed view is
> merely a writing simplification, and you are always free not to use it
> without losing any functionality. OTOH, you would have no other way to
> access a subcomponent. Therefore, it makes sense that the subcomponent
> is "stronger".

From a wider (and simpler) point of view a record component is just a pair
of primitive operations (getter/setter) on the record type. That makes them
conflicting with any user-defined primitive operations of same signature.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2012-10-28  2:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-21 22:55 Basic issue with dotted notation and tagged types Yannick Duchêne (Hibou57)
2012-10-22  7:46 ` J-P. Rosen
2012-10-22  8:02   ` Dmitry A. Kazakov [this message]
2012-10-22 13:46     ` Yannick Duchêne (Hibou57)
2012-10-22 10:52   ` Marius Amado-Alves
2012-10-22 11:18     ` Georg Bauhaus
2012-10-22 11:37       ` Marius Amado-Alves
2012-10-22 14:11       ` Yannick Duchêne (Hibou57)
2012-10-22 11:45     ` Niklas Holsti
2012-10-22 14:17       ` Maciej Sobczak
2012-10-22 13:50     ` Yannick Duchêne (Hibou57)
2012-10-22 10:41 ` AdaMagica
replies disabled

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