comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Passing the same actual as both in and out formal parameters?
Date: Tue, 17 Nov 2009 16:23:56 -0800 (PST)
Date: 2009-11-17T16:23:56-08:00	[thread overview]
Message-ID: <d21bd72b-be0a-4c16-a33e-1b96555acaa4@a39g2000pre.googlegroups.com> (raw)
In-Reply-To: hdvduu$8lh$1@news.tornevall.net

On Nov 17, 4:11 pm, "Jeffrey R. Carter"
<spam.jrcarter....@spam.acm.org> wrote:
> Randy Brukardt wrote:
>
> > Right, that's my understanding of the point. The only problem is, there
> > isn't any sane way to describe such an assertion.
>
> Given that the types are by-reference, would comparing 'access of the parameters
>   serve?
>
> pragma Assert (A'access /= B'access);

First of all, for this to work in the general case, that would need a
major change in language semantics, since you need an access type in
order for 'Access to be allowed.  The only way this would be legal is
if there happened to be exactly one "=" operator directly visible with
operands of some named access-to-T type.  (Also, if "=" were
overridden with a user-defined operator that did something unexpected,
it would fail, but nobody would do that.)

Second, it only catches the case where the operands are of the same
type; it won't catch other overlaps such as

   P2 (A => Object, B => Object.Component);

                                     -- Adam




  reply	other threads:[~2009-11-18  0:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-17  9:50 Passing the same actual as both in and out formal parameters? Ludovic Brenta
2009-11-17 10:31 ` Jean-Pierre Rosen
2009-11-17 11:26   ` Ludovic Brenta
2009-11-17 13:13     ` Jean-Pierre Rosen
2009-11-17 16:07       ` Ludovic Brenta
2009-11-18 10:00         ` Jean-Pierre Rosen
2009-11-17 10:40 ` Niklas Holsti
2009-11-17 16:26 ` Adam Beneschan
2009-11-17 21:25   ` Randy Brukardt
2009-11-18  0:11     ` Jeffrey R. Carter
2009-11-18  0:23       ` Adam Beneschan [this message]
2009-11-18  3:47         ` Jeffrey R. Carter
replies disabled

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