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,cfe6bee6cb133ace X-Google-Attributes: gid103376,public X-Google-Thread: 1094ba,3e0895d4223034d7 X-Google-Attributes: gid1094ba,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Fortran Myths & Disinformation Wanted Date: 1999/02/12 Message-ID: #1/1 X-Deja-AN: 443722111 References: <87g18d3lsv.fsf@bglbv.my-dejanews.com> <19990210201511.04389.00000245@ng-fx1.aol.com> <36C3BEA7.F96F80FC@ix.netcom.com> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.fortran,comp.lang.ada Date: 1999-02-12T00:00:00+00:00 List-Id: > Fortran can also be fairly terse, if you just use the f77 way: function f(a, x) g(x) = 1-a*x**2 f = sin(g(2*x)) - cos(g(x/2)) end > >That example is a little too simple to be interesting. Anyway, > >Here is the Ada 95 version: {reformatted for clarity} with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions; function F (A, X: Float) return Float is function G (X: Float) return Float is begin return 1.0-A*X**2; end G; begin return Sin(G(2.0*X))-Cos(G(X/2.0)); end F; Looked at this way the difference in size is obviously due to requiring all declarations to be explicit, and some added reserved words (begin and return). Of course, you might want to use (Fortran) double or (Ada) Long_Float instead. In the Ada version you just have to add Long_ in six places (and the compiler will scold you if you miss one) while in Fortran you have to replace implicit declarations with explicit declarations and hope you don't miss one. There should be no difference in generated code between the two versions, so the tradeoff is the traditional Ada tradeoff of more required text to reduce errors and make maintenance easier. If you don't care about maintenance, use APL which is even terser than Fortran. I do.--I find that I program in four languages consistantly, of all the languages I know: Ada for anything that needs to be read or maintained, SQL for database queries, csh for shell scripts and APL for exploratory data analysis. (Please, no arguments about csh versus sh, bash, or tsh. I use all of them, but my job requires mostly csh. Similarly, I prefer ODBC for embedded database access, but most of my database access coding is in the form of standalone scripts.) -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...