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,d901a50a5adfec3c,start X-Google-Attributes: gid103376,public X-Google-Thread: 1094ba,9f0bf354542633fd X-Google-Attributes: gid1094ba,public From: gisle@krake.ii.uib.no (Gisle S{lensminde) Subject: Re: Fortran or Ada? Date: 1998/09/22 Message-ID: X-Deja-AN: 393486464 References: <36068E73.F0398C54@meca.polymtl.ca> Organization: University of Bergen, Norway Newsgroups: comp.lang.fortran,comp.lang.ada Date: 1998-09-22T00:00:00+00:00 List-Id: > Dear Fortran experts: > > A friend of mine (a computer engineer who uses C++) insists that Ada95 > is the best programming language for scientists and non-computer > engineers . His reasons: > > (from: http://www.adahome.com/Tutorials/Lovelace/s1s1.htm) I have tried to make answers to some of the question. My experiences is from Ada95, C, C++, Fortran77 and Java, and not so much f90. the answer is also sent comp.lang.ada. > 1. Packages (modules) of related types, objects, and operations can be > defined. Modules exists in Fortran 90 also, and is even inspired from Ada. > 2. Packages and types can be made generic (parameterized through a > template) to help create reusable components. That is also in Fortran 90/95 AFAIK. > 3. Errors can be signaled as exceptions and handled explicitly. Many > serious errors (such as computational overflow and invalid array > indexes) are automatically caught and handled through this exception > mechanism, improving program reliability. Yes, and this detects many errors, but I think some Fortran 90 compilers also checks indexes, if you ask them to do so. Maybe not as good as Ada. > 4. Tasks (multiple parallel threads of control) can be created and > communicate. This is a major capability not supported in a standard way > by many other languages. Yes > 5. Data representation can be precisely controlled to support systems > programming. Yes. > 6.A predefined library is included; it provides input/output (I/O), > string manipulation, numeric functions, a command line interface, and a > random number generator (the last two were available in Ada 83, but are > standardized in Ada 95). > 7. Object-oriented programming is supported (this is a new feature of > Ada 95). In fact, Ada 95 is the first internationally standardized > object oriented programming language. Yes, but the model for OO is a litle bit unusual, compared to other languages. > 8. Interfaces to other languages (such as C, Fortran, and COBOL) are > included in the language (these have been significantly enhanced in Ada > 95). At least one Ada compiler (from Intermetrics) can generate Java > Virtual Machine (J-code) from Ada, so people can use Ada to develop Java > applets and applications. Interfaces to other languages is often important, and yes Ada 95 does this in a portable way, and I often miss that in C++, but I have no experience with the Appletmagic compiler. > After reading these reasons, following questions came to my mind: (mind > on an engineer who has to use F77/90, sometimes C) > > 1) I know some of these capabilities is already supported by the Fortran > standard and some of them will be added to the next release...is Fortran > late? How can I convince the new generation of engineers to wait for the > next Fortran standard to have all of these capabilities? Some of the most important features it in f90/95 already, like modules, dynamic memory allocation, generics, data structure constructions and other modern features, but you will probably wait long for some features in Ada, like strong static typing all trough the language. To sit down waiting for the next standard is not the best way of using your time. > 2) Is there any comparison between performance of Fortran90/95 and Ada95 > compilers? It is difficult to compare two different languages in a fair way. For example Ada has index checking and exception handling wich Fortran doesn't. You can of cause turn off these, but it's often valuable to use them, becase they trap bugs on an early stage, and makes the code more reliable Such features has a performance penalty. But if we write comparable code in both languages, I would think that Fortran would win in a raw speed test, because some of the Fortran compilers optimize extremly well. > 3) It seems that Ada is the most popular language for safety-critical > systems. Why Ada? Why not Fortran or C++? What makes Ada suitable for > this kind of programming? Strong and static typing, extremly well defined syntax and semantics and very reliable compilers made for the purpose, well defined and reliable interface to lowlevel features, multitreading built in to the language, and a language designed for the task. C++ disqualifies from critical code for several reasons. Things like pointers and pointer aritmetrics and the possibility to cast everything to everything, makes the language unsafe. Many such systems must have total control of memory usage, and no dynamic memory usage is allowed in many cases, and makes C and C++ is impossible to use in the highest safity levels. (But C is used in some safity critical stuff anyway, and C is widely used for embedded targets.) Fortran do not have all the weakneses of C this respect, but is still not design for such tasks. The weak typing, is the bigest problem here. Historically, implicit variables have caused problems in safety critical code, but with IMPLICIT NONE that should not be an issue. > 4) What can Fortran offer to the engineers that Ada can't? (except > backward and legacy code compatibility) Engineers are familar with Fortran, and knows what it stands for. In an organization, it is often difficult to change. Its easier to go for Fortran90/95 (Often even that is very difficult). Anyway, many of the most important features that helps increasing the software design and quality, can be found in modern Fortran. The danger is that everything still looks like Fortran66 :-(, and not like the, say the F subset of Fortran 90, and the spaghetti remains. A conversion to f90 from f77 must be followed by training in the new principles. Ada still have a better static and dynamic type checking, and have syntax and sematics designed for good software engineering, early detection of errors, exception handling and OO, so Ada is my choice, if no compromises should be taken. > I know the answers to these questions could be long and/or they are > already discussed. I appreciate if you point me to the related > references. I have not seen any direct comparision between f95 and Ada95, so general info about both languages is probably the best source of information. I have used Ada more than Fortran, so it's most Ada in my references. http://www.adahome.com - Ada information, this site contains pointers to http://www.gnat.com - A free professional quality Ada 95 compiler http://www.adahome.com/Ammo/cpp2ada.html Ada for C and C++ programmers. http://www.fortranlib.com - Fortran info http://www.hpctec.mcc.ac.uk/hpctec/courses/Fortran90/F90course.html f77 to f90 conversion course. http://www.ifs.hr/ifs/razno/calc/HTMLF90Course/HTMLNotes.html f90 notes