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,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-08 08:46:59 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!news-out.visi.com!petbe.visi.com!newshub.northeast.verio.net!verio!newsfeed.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Certified C compilers for safety-critical embedded systems Date: 08 Jan 2004 11:46:58 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: pip1-5.std.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1073580418 6230 192.74.137.185 (8 Jan 2004 16:46:58 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 8 Jan 2004 16:46:58 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:4213 Date: 2004-01-08T11:46:58-05:00 List-Id: "Alexandre E. Kopilovitch" writes: > Robert A Duff wrote: > > > Ada functions are simply a procedure with a different calling syntax. > > >From a compiler writer's viewpoint - perhaps yes. I'm not talking about the compiler writer. >... But certainly not from > programmer's viewpoint - if that programmer has and uses a brain (that is, > not just eyes and fingers). There is a well-known fact that human brain tends > to differentiate between result-oriented and "good next step" approaches, and > this has nothing specifically mathematical. Anyway, returning to programming, > I suppose you will not claim that there is absolutely no difference (except > syntax) between functional and procedural programming languages. No, I don't claim that, although at some level they are equivalent; you can convert a procedural program into a functional one by adding a lot of parameter passing. My point was just that Ada's functions are *not* functions in the functional programming sense. Calling them "function" is therefore misleading. I *do* claim that both of the following compute the same mathematical function: function F(X: Integer) return Integer is begin return X**2; end F; function P(X: Integer; Result: out Integer) is begin Result := X**2; end P; but use different notations at the call site. The Oz language makes these issues a bit clearer, I think. It has a pure-functional subset that allows either notation! Interesting. Now, if Ada had a way to declare pure functions, enforced by the compiler, then I wouldn't mind calling them functions. But that's not what Ada's functions are. > > IMHO, both kinds of subprograms should have been called "procedures". > > I think that these both kinds of subprograms are already called "subprograms", > so there is no need for another common name for them. I'm not suggesting "another" name. I'm suggesting that a *single* name would suffice, where Ada has three names: function, procedure, subprogram. - Bob