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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:3946:: with SMTP id g67-v6mr5079422ioa.20.1539991691736; Fri, 19 Oct 2018 16:28:11 -0700 (PDT) X-Received: by 2002:a9d:c42:: with SMTP id 60mr654649otr.7.1539991691603; Fri, 19 Oct 2018 16:28:11 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.216.MISMATCH!x98-v6no118324ita.0!news-out.google.com!l70-v6ni130itb.0!nntp.google.com!z5-v6no118584ite.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 19 Oct 2018 16:28:11 -0700 (PDT) In-Reply-To: <1a143584-e575-47b2-ab99-f5b6c3382add@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=75.99.9.146; posting-account=s89PEgoAAABHs2ETFyOrCeTQVQJAfzKq NNTP-Posting-Host: 75.99.9.146 References: <0a680981-7b14-4b72-b51a-b06ab7822d54@googlegroups.com> <1a143584-e575-47b2-ab99-f5b6c3382add@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <63024b3f-d176-4b64-a861-a28d1dfca1f1@googlegroups.com> Subject: Re: A function that cannot be called? From: marciant@earthlink.net Injection-Date: Fri, 19 Oct 2018 23:28:11 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:54665 Date: 2018-10-19T16:28:11-07:00 List-Id: On Friday, October 19, 2018 at 4:25:53 PM UTC-4, Shark8 wrote: > >=20 > > Before Ada 95 or Ada 2005 it would have been a package > > spec that had the following (with P1,P2,etc. being valid types):=20 > >=20 > > type Not_Objects_Just_for_Parameters is limited private; > > function Return_A_Corresponding_Value(p1:t1;p2:t2;etc...) > > return Not_Objects_Just_for_Parameters; > > procedrure Force_Call_Of_Function_1 > > (Function_Call:Not_Objects_Just_for_Parameters; > > Other_Param3:p3;etc...); > > procedrure Force_Call_Of_Function_2 > > (Function_Call:Not_Objects_Just_for_Parameters; > > Other_Param4:p4;etc...); > >=20 > > I miss that way of forcing/ensuring new execution of some > > code as a prerequisite of use of a subprogram. ;-( > > Being able to hang on to the result of such a function > > by using renames wrecks this usage. >=20 > Isn't there a similar effect that can be had via >=20 > Type Just_For_Parameters(<>) is limited private; > Function Get_Param return Just_For_Parameters; > --... > PRIVATE > Type Stub_Record is null record; > Type Just_For_Parameters is not null access Stub_Record > with Size =3D> 0; > --... > Or am I misunderstanding what you're getting at? (Quite possible as I've = never had occasion to use Size 0 "access"-types.) I think you are but am not sure. I was focussing of the type from the point= of view of an outside user of the package and the Size code that you prese= nted would only affect use in the package body or child units. The big problem that messed things up for me was now being able to somethin= g like this: ... declare ob : Limitted_Private_Type renames Function_Call(...); begin Proc1(ob); Proc2(ob); Proc3(ob); ... all procs getting the same value/object (Function_Call is evaluated only once.) Oh! Maybe the bothersome thing now is that functions can no longer return a limited result. (Not sure if that was a correct statement.) Anyway, although I find that do not remember the exact details for now, but= I do remember for sure that it once was possible to declare a visible type= in a package spec that could not be used by an outside user as the type of= a variable or constant and the only things that could be passed to any sub= programs in the type's package were a call of a function from that package = that returned that type (and maybe also deferred constants from that same p= ackage). Wow! It _has_ been a long ride. :-) :-/ =20