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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ad988eb0a9545c86 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-14 07:00:04 PST Path: supernews.google.com!sn-xit-03!supernews.com!news-feed.riddles.org.uk!skynet.be!fu-berlin.de!uni-berlin.de!b8733.pppool.DE!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Problem trying to implement generics. Date: Sat, 14 Apr 2001 16:03:15 +0200 Message-ID: <3AD858A3.3070803@elros.cbb-automation.de> References: <9b46dr$cd8$1@taliesin.netcom.net.uk> <9b6jtu$4is$2@taliesin.netcom.net.uk> <9b6m27$68e$1@taliesin.netcom.net.uk> <0JBB6.10484$FD1.1197250@news6-win.server.ntlworld.com> <9b7tce$laf$2@taliesin.netcom.net.uk> <9b85fj$25r$1@taliesin.netcom.net.uk> NNTP-Posting-Host: b8733.pppool.de (213.7.135.51) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 987256779 8767638 213.7.135.51 (16 [77047]) User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20001108 Netscape6/6.0 X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:6890 Date: 2001-04-14T16:03:15+02:00 List-Id: Brian Rogoff wrote: > On Sat, 14 Apr 2001, Ayende Rahien wrote: > >> "Brian Rogoff" wrote in message >> >>> Or, would you just allow procedures to return values? ;-) >> >> No, but I would like to have a function that I can place in an if (etc) that >> change the variables I gives it. > > You can achieve this with access parameters, or the trick that Robert Duff > described (which obviously only works for limited types). > >> It's not a big deal, I was just wondering what was the reason for this decistion. > > A desire to have Ada functions correspond more closely to mathematical > functions, which don't modify their arguments? I think in general it is > good style *not* to have functions modifying their arguments, but as usual > there are relatively rare exceptions. I think it would have been better to > allow out and in-out params, and make sure that programmers who abuse them > are beaten severely. > > You're right, it shouldn't be too big of a deal for you. And I doubt it > will ever change in any future version of Ada, since enough people seem > to really like this restriction. Well, but what I still cannot understand, what is the objection against *procedures* returning a value: procedure Foo (...) return ...; A related question is a syntax sugar to ignore unused result of an expression. For instance, instead of clumsy declare Dummy : Integer; begin Dummy := Some_API_Call (...); end; something like: null Some_API_Call (...); Regards, Dmitry Kazakov