comp.lang.ada
 help / color / mirror / Atom feed
From: "Adam Beneschan" <adam@irvine.com>
Subject: Re: Predefined equality, reemergence
Date: 5 Apr 2006 11:47:17 -0700
Date: 2006-04-05T11:47:17-07:00	[thread overview]
Message-ID: <1144262837.486161.27060@i39g2000cwa.googlegroups.com> (raw)
In-Reply-To: 1144239394.052533.214270@t31g2000cwb.googlegroups.com

christoph.grein@eurocopter.com wrote:
> Adam wrote:
> "Reading this section closely, it appears that if the actual
> type for T is ACT, and ACT is a tagged record type, and there is a
> user-defined primitive operator "=" on ACT, then: if ACT is a private
> type, the predefined "=" is the user-defined "=" (4.5.2(15)), but if
> ACT is not a private type, the user-defined "=" isn't used"
>
> I think you misread this sentence. It says: For a private type, it
> depends on whether the full type is tagged or not.
> If it is tagged, the primitive equality is used, else the predefined
> equality is used.
>
> So the result is: For tagged types (whether visibly tagged or not),
> predefined equality when overridden is lost forever.

I don't get how this result follows from the sentence in 4.5.2(15).
That sentence appears to talk about private types, but appears to say
nothing at all about non-private types.  In my example, 12.5(8) tells
us we need to find out what predefined equality is for the actual type,
and since the actual type isn't a private type, 4.5.2(15) would appear
not to apply at all.  Or is your last statement still speaking only
about private types?

Anyway, I can understand your statement that when an overriding "=" is
provided for a tagged type, the predefined "=" may no longer reemerge.
It just appears to me that there's an unintended loophole in the
language that makes this statement false in some instances---12.5(8)
says that "=" on a generic formal type refers to the predefined equals
operator on the actual, and there's nothing that says that the
predefined "=" on a tagged type T *is* *always* the overriding "="
operator if there is one.  4.5.2(24) says this is the case for a
*component* of type T, when you're using "=" on a larger object that
contains such a component; but it doesn't say that it's the case when
you're comparing objects of type T that are not components.

I'm prepared to accept that this is just an omission in the RM, and
that the predefined "=" never reemerges for tagged types.  That would
satisfy me; it answers my original question and convinces me that the
output of my example should be TRUE in both cases.  It still seems to
me that the RM is a bit vague on the question of what 12.3(16) and
8.3(13) say about the *body* of the implicit "=" on Rec (in my example)
that gets copied when instantiating.

                           -- Adam




  reply	other threads:[~2006-04-05 18:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-04 19:30 Predefined equality, reemergence Adam Beneschan
2006-04-04 19:46 ` Adam Beneschan
2006-04-04 23:00   ` Randy Brukardt
2006-04-04 23:57     ` Adam Beneschan
2006-04-05 12:16       ` christoph.grein
2006-04-05 18:47         ` Adam Beneschan [this message]
2006-04-05 22:01           ` Robert A Duff
replies disabled

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