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,2308afbbe4ecec0b X-Google-Attributes: gid103376,public From: "Dmitry A. Kazakov" Subject: Re: Subverting 'Access for Sub-programs Date: 1999/08/12 Message-ID: <37B2D220.9CAAD611@gandalf.atm.fh-luebeck.de>#1/1 X-Deja-AN: 511851747 Content-Transfer-Encoding: 7bit References: <37A71EF1.2201@dera.gov.uk> <37A7FDE8.4F5@dera.gov.uk> <7o9vrv$qgt$1@wanadoo.fr> <7oc5ih$6mb$1@wanadoo.fr> <7oejga$28i$1@nnrp1.deja.com> <37AEF7BF.7BBC8E06@averstar.com> <7oqahu$3s0$1@nnrp1.deja.com> <37B18CF0.F50A802B@gandalf.atm.fh-luebeck.de> <7osa8r$gdq$1@nnrp1.deja.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@de.uu.net Organization: Customer of UUNET Deutschland GmbH, Dortmund, Germany Mime-Version: 1.0 NNTP-Posting-Date: 12 Aug 1999 13:50:04 GMT Newsgroups: comp.lang.ada Date: 1999-08-12T13:50:04+00:00 List-Id: Robert Dewar wrote: > In article <37B18CF0.F50A802B@gandalf.atm.fh-luebeck.de>, > "Dmitry A. Kazakov" wrote: > > I believe that the actual problem is in using pointers. In > 90%, I would > > say, there is > > no need to pass a subroutine by pointer. It should be passed by > > reference: What we > > need is something like (syntax is imaginary): > > But passing subprograms as parameters is only one of many > possible uses of subprogram pointers. Indeed it is one of > the weakest uses, in that this particular use often can > be replaced by generics. The motivation for providing > pointers to subprograms during the Ada 95 design was > driven by other uses entirely, most notably by the need > for implementing call backs (and of course if you think > about it the use of procedure pointers implicit in > dynamic dispatching is also another kind of use completely > unrelated to the call by reference notion). I do not argue against subprogram pointers. But it is a bit strange to provide them without variables which values they point to. (:-)) As for call backs there are different sorts of them. 1. When pointer to call back will be copied by the callee, then yes, it must be passed by pointer. Further, in this case it is pretty meaningful not to allow 'unchecked_access which result could be catastrophic in some contexts. 2. Otherwise (when used locally) it should be passed by reference, which would lift all unnecessary (in this case) limitations of 'access. The same way you pass a variable. Best regards, Dmitry