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-Thread: 5b1e799cdb,3ef3e78eacf6f938 X-Google-Attributes: gid5b1e799cdb,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!188.40.43.213.MISMATCH!feeder.eternal-september.org!eternal-september.org!not-for-mail From: Nicholas Paul Collin Gloucester Newsgroups: comp.lang.eiffel,comp.lang.ada,comp.lang.modula3,comp.lang.pascal,comp.programming Subject: Re: Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3? Date: Mon, 20 Jul 2009 12:15:08 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.eternal-september.org U2FsdGVkX19IJYv54OZZvtRRwABujN39IYbzao7MyIocO7pHk8Z6u94ahTSrkgquNVph7sqHRf2U+1JxDZL6hSxv+CF4HE3au9GSEedB9BGJA49jOdMxixo1uwkq7VljxKq+AwUfqYVAwH36CFJ3nKp8gs0dLi69gio4+ciSc/c= X-Complaints-To: abuse@eternal-september.org NNTP-Posting-Date: Mon, 20 Jul 2009 12:15:08 +0000 (UTC) X-Auth-Sender: U2FsdGVkX1+Lw27BZ24edtJld1uYSbNAiMs08a45TWCnnxL/EfAQgagWzmYfENs73h8RUoOHdXQ= Cancel-Lock: sha1:fNx7zVWqUUsA5suWoIFfvYxLJ5A= User-Agent: slrn/0.9.9p1 (Linux) Xref: g2news2.google.com comp.lang.eiffel:324 comp.lang.ada:7170 comp.lang.modula3:50 comp.programming:11884 Date: 2009-07-20T12:15:08+00:00 List-Id: On 2009-07-18, A. Taverna submitted for the newsgroups comp.lang.eiffel; comp.lang.ada; comp.lang.modula3; comp.lang.pascal; and comp.programming ... |---------------------------------------------------------------------------| |"Hi folks! | | | |I'm a CS student and I often need to write number-crunching code dealing | |with combinatorial optimization problems. | |What I do usually is implementing ad-hoc algorithms and testing their | |performance against other previously-known solutions, including general | |solvers. | | | |In the past I used C, but now I have decided to change language. | |I'm looking for a "better" one. | | | |Here follow the features it should have, ranked approximately by relevance:| | | |0) open-source support and an alive community | |1) directly compiled to efficient code | |2) statically typed and object-oriented, better if multi-paradigm | |3) general-purpose libraries (possibly standardized, either by standard | |or de facto), including containers and some math abstractions. | |4) garbage collected. As an alternative, provide memory management | |policies via libraries (e.g. memory pools and such) | |5) optional run-time checks and some kind of control over compilation | |and low-level issues | |6) "relatively simple and consistent" | | | |So I have considered these alternatives: FreePascal, Eiffel, Ada and | |Modula-3. | |I have taken a look at all of them and I'm still undecided. Below are | |the impressions I got for each language. | |Can you help me? Feel free to recommend other languages as well. | | | |TIA | | | |--> Impressions I got for each language | | | |- FreePascal is a safe and modular alternative to C and C++, but | |it is also close to the latter in terms of expressiveness. Moreover it | |doesn't seem to have the libraries I need. | |==>Qualifies for 0,1,2,5. Not sure about 3 and 4 | | | |- Eiffel is geared toward application programming in | |medium/large-sized teams relying heavily on OO modelling. It is designed | |for (re)usability, correctness and efficiency in this order. | |My needs are somewhat different though. | |The main gripe I have with Eiffel is the lack of a well-documented | |standard gpl'ed library. | |GOBO and EiffelBase seem to have incomplete or non-free documentation | |and I couldn't find tutorials; as such, I couldn't get a clear picture | |about them. | |==> Qualifies for 0,1,2,4,5 and 6. Not sure about 3. | | | |- Ada is best suited for large teams and/or critical software, thus | |it may be overkill for my work, OTH it could have anything I might | |happen to need. | |What holds me from jumping onto Ada is the potential complexity | |It would be interesting to hear the experience of other people learning | |Ada from the C/Java background. | |As for memory management (requirement 4), I heard there are different | |takes on the matter: | |(a) Ada uses dynamic stack allocation a lot, and in a transparent way, | |reducing the need of manual management (MM) | |(b) Ada libraries adopt idioms that further simplifies MM issues | |(c) Conservative garbage collectors such as Bohem's can be used with | |Ada, and they are supposed to work "better" with Ada than with unsafe | |languages such as C and C++ | | | |So can MM be said to be easier in Ada than in C? I hope Ada-ers will | |mercifully shed some light on the issue. | | | |There seems to be a lot of Ada95 free documentation on the net, I guess | |it's suitable for Ada05 as well. | |==> Qualifies for 0,1,2,3,5 and, partially, 4 | | | |- Modula-3 is simpler/smaller than Ada and has been successfully | |used for system/application programming. | |It seems to be the most consistent, simple and easy to grok, but I | |couldn't find any container/math library ready to use. | |==> Qualifies for 0,1,2,4,5,6." | |---------------------------------------------------------------------------| Ciao! I agree that static typing is important, but Modula-3; Eiffel; and many versions of Pascal perhaps including FreePascal are restricted to structural equivalence of types only. This is not sufficient strong typing. I give an example showing that Ada is better than Eiffel (and Modula-3 and many versions of Pascal) in this regard, based on an example by Bertrand Meyer in the second edition of the book "Object-oriented software construction". In that book, Dr. Meyer claimed that Ada's overloading is inferior to Eiffel's overloading. He called Ada's overloading syntactic overloading. He called Eiffel's overloading semantic overloading. I believe that he was being sincere, but he was definitely mistaken. He claimed that it would not be possible to sensibly discriminate between overloaded subprograms for a point if the real-number parameters could be in any of Cartesian notation and polar notation. This is refuted by the following Ada code... procedure Syntactic_Overloading_Example_Based_On_An_Example_By_Bertrand_Meyer is type Horizontal_Coordinate is new Float; type Vertical_Coordinate is new Float; procedure Point(X : Horizontal_Coordinate; Y : Vertical_Coordinate) is begin null; --Whatever. end; type Magnitude is new Float; type Radians is new Float range -3.14*2.0 .. 3.14*2.0; procedure Point(R : Magnitude; Theta : Radians) is begin null; --Whatever. end; X : Horizontal_Coordinate; Y : Vertical_Coordinate; R : Magnitude; Theta : Radians; begin X := 1.1; Y := 2.2; R := 3.3; Theta := 0.5; Point(X, Y); Point(R, Theta); --The above is all legal Ada. However, the following mistakes would --be legal in Eiffel but would be rejected by an Ada compiler... R := X; --An example compiler complaint... --"Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:29:09: expected type "Magnitude" defined at line 9 --Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:29:09: found type "Horizontal_Coordinate" defined at line 2 --gnatmake: "Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb" compilation error". Point(X, Theta); --Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:04: no candidate interpretations match the actuals: --Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:10: expected type "Magnitude" defined at line 9 --Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:10: found type "Horizontal_Coordinate" defined at line 2 --Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:10: ==> in call to "Point" at line 11 --Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:13: expected type "Vertical_Coordinate" defined at line 3 --Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:13: found type "Radians" defined at line 10 --Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:13: ==> in call to "Point" at line 4 --gnatmake: "Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb" compilation error end;