From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,965fbd9798ca1677 X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: Re: Return by reference Date: 1999/11/03 Message-ID: <38203d4a_1@news1.prserv.net>#1/1 X-Deja-AN: 543944804 Content-transfer-encoding: 7bit References: Content-Type: text/plain; charset="US-ASCII" X-Complaints-To: abuse@prserv.net X-Trace: 3 Nov 1999 13:48:58 GMT, 129.37.62.132 Organization: Global Network Services - Remote Access Mail & News Services Mime-version: 1.0 Newsgroups: comp.lang.ada Date: 1999-11-03T00:00:00+00:00 List-Id: In article , Brian Rogoff 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. 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. -- 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