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-16 07:37:51 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!newsfeed.icl.net!dispose.news.demon.net!demon!diablo.netcom.net.uk!netcom.net.uk!news1.ebone.net!news.ebone.net!fu-berlin.de!uni-berlin.de!b8662.pppool.DE!not-for-mail From: dmitry@elros.cbb-automation.de (Dmitry A. Kazakov) Newsgroups: comp.lang.ada Subject: Re: Problem trying to implement generics. Date: Mon, 16 Apr 2001 14:34:06 GMT Message-ID: <3adafb3f.11489051@news.cis.dfn.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> <3AD858A3.3070803@elros.cbb-automation.de> <9b9qjc$nk9$1@taliesin.netcom.net.uk> <3AD9A697.8080402@elros.cbb-automation.de> <9bcttr$134$1@taliesin.netcom.net.uk> NNTP-Posting-Host: b8662.pppool.de (213.7.134.98) X-Trace: fu-berlin.de 987431412 9313851 213.7.134.98 (16 [77047]) X-Newsreader: Forte Free Agent 1.21/32.243 Xref: supernews.google.com comp.lang.ada:6913 Date: 2001-04-16T14:34:06+00:00 List-Id: On Sun, 15 Apr 2001 22:44:23 +0200, "Ayende Rahien" wrote: >"Dmitry A. Kazakov" wrote in message >news:3AD9A697.8080402@elros.cbb-automation.de... >> >> >> Ayende Rahien wrote: >> >> > "Dmitry A. Kazakov" wrote in message >> > news:3AD858A3.3070803@elros.cbb-automation.de... >> > >> >> Well, but what I still cannot understand, what is the objection against >> >> *procedures* returning a value: >> > >> > Because that is the difference between functions & procedures? >> >> The difference between them is that a function may (supposedly) have no >> side effects and hence no [in]out parameters. Function is (I am trying >> to follow rigorous point of view) an attempt to model mathematical >mappings. > >Do you mean that it's similar to const fucntions in C++? I think Ada's functions are similar to ones in C++, which have all parameters const. Though both only mimic mathematical mappings (functions), for a programmer always has an ability to achive side effects. Moreover no routine can have no side effects. Something allways happens upon its call. For instance the process working page set may be extended in the result of a function call, etc. So it is mostly about which side effects are counted for relevant and which not. From my point of view there is nothing wrong which a *function* that reads a character from the file. Yes it changes the state of the file, but this effect is not relevant to me, as well as one that the operator should move the mouse and press a button to deliver me that character. If I would like for some reason to ensure that the file state is not changed, then I would pass it as an in-parameter and would be awarded with a compilation error, because an inout-parameter is required. It is stone-safe. So in my opinion the distiction between functions and procedures is rather unnatural. But it would OK if procedures could return values. Regards, Dmitry Kazakov