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: Brian Rogoff Subject: Re: Return by reference Date: 1999/11/03 Message-ID: #1/1 X-Deja-AN: 544255900 References: Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: nntp1.ba.best.com 941691457 208 bpr@206.184.139.136 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-11-03T00:00:00+00:00 List-Id: On 3 Nov 1999, Lutz Donnerhacke wrote: > * Brian Rogoff wrote: > >In any case, in response to Lutz Donnerhack, who wonders why I might want > > 'Donnerhacke' (= 'thunder & hoe') please. Today exaktly seven guys with this > surname live on this earth. 'Donnerhack' is much more common (something like > 'Smith' ;-)). My apologies. > >to do such a thing, consider the problem of trying to write a printf like > >like formatting library in Ada. One interface (proposed in the programming > >FAQ at adahome) goes something like this > > > > type Format_Type is limited private; > > > > function Format(S : in String) return Format_Type; > > procedure Printf (Fmt : in Format_Type); > > function "&" (Fmt : in Format_Type; S : in String) return Format_Type; > > function "&" (Fmt : in Format_Type; I : in Integer) return Format_Type; > > > >etc. > > > >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? > > To my first and ignorant view it should work fine with an unlimited type. > I implemented it for myself to check this view. Your will get it by E-Mail. Thanks for the code, but I already know how to do this with a type whose public view is limited and its private view, not limited. I was wondering if I can do this entirely with minimal potential copying. -- Brian