From: Brian Rogoff <bpr@shell5.ba.best.com>
Subject: Re: Return by reference
Date: 1999/11/03
Date: 1999-11-03T00:00:00+00:00 [thread overview]
Message-ID: <Pine.BSF.4.10.9911032044380.14434-100000@shell5.ba.best.com> (raw)
In-Reply-To: 38203d4a_1@news1.prserv.net
On Wed, 3 Nov 1999, Matthew Heaney wrote:
> In article <Pine.BSF.4.10.9911021905050.1386-100000@shell5.ba.best.com>
> , Brian Rogoff <bpr@shell5.ba.best.com> wrote:
>
> > I was going to use the "Rosen trick" to modify data in the Fmt each time
> > "&" is called. Unfortunately, that requires making the full view of
> > Format_Type limited and you run into the problem I described.
> >
> > Is there a cleaner way to implement that interface?
>
> 1) Privately implement the type as tagged, to make it a by-reference
> type.
>
> 2) This allows you to invoke RM95 13.3 (16), to take the address of
> parameter.
>
> 3) Pass the address to an instantiation of
> System.Address_To_Access_Conversions, which gives you a variable view of
> the parameter.
Interesting idea. I'll try it, but it still does more copying than I'd
have liked, since it isn't a return-by-reference type. You'll end up
copying on the way out.
> Note that there has been a subtle error running throughout this thread.
> There is nothing wrong with returning a "by-reference" type as a
> function return type; the error is returning a *limited* type.
No, I was quite clear in my post. The issue is about "return-by-reference"
types (see 6.5.11) and why returning an argument of such a type is the
same as returning a local variable of such a type (it is the same, in that
it raises Program_Error). You can certainly return a (limited)
return-by-reference type from a function, it just has to be global to that
function.
-- Brian
>
>
> --
> Science is, foremost, a method of interrogating reality: proposing
> hypotheses that seem true and then testing them -- trying, almost
> perversely, to negate them, elevating only the handful that survive to
> the status of a theory. Creationism is a doctrine, whose adherents are
> interested only in seeking out data that support it.
>
> George Johnson, NY Times, 15 Aug 1999
>
>
next prev parent reply other threads:[~1999-11-03 0:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-11-01 0:00 Return by reference Brian Rogoff
1999-11-02 0:00 ` Robert A Duff
1999-11-02 0:00 ` Brian Rogoff
1999-11-03 0:00 ` Matthew Heaney
1999-11-03 0:00 ` Matthew Heaney
1999-11-03 0:00 ` Brian Rogoff [this message]
1999-11-03 0:00 ` Lutz Donnerhacke
1999-11-03 0:00 ` Brian Rogoff
1999-11-04 0:00 ` Lutz Donnerhacke
1999-11-06 0:00 ` Brian Rogoff
1999-11-07 0:00 ` Lutz Donnerhacke
1999-11-04 0:00 ` Robert A Duff
1999-11-02 0:00 ` Lutz Donnerhacke
-- strict thread matches above, loose matches on Subject: below --
2017-12-17 14:38 Jere
2017-12-17 14:57 ` Dmitry A. Kazakov
2017-12-18 0:51 ` Mehdi Saada
2017-12-18 8:18 ` Dmitry A. Kazakov
2017-12-18 10:47 ` Mehdi Saada
2017-12-18 12:16 ` Dmitry A. Kazakov
2017-12-18 22:41 ` Randy Brukardt
2017-12-18 22:33 ` Randy Brukardt
2017-12-19 1:29 ` Jere
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox