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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 4f1905883f,40783f7f814400c9,start X-Google-Attributes: gid4f1905883f,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!v37g2000prg.googlegroups.com!not-for-mail From: fft1976 Newsgroups: comp.lang.scheme,comp.lang.ada,comp.lang.functional,comp.lang.c++,comp.programming Subject: Re: Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3? Date: Tue, 28 Jul 2009 13:57:05 -0700 (PDT) Organization: http://groups.google.com Message-ID: <2009a75f-63e7-485e-9d9f-955e456578ed@v37g2000prg.googlegroups.com> References: NNTP-Posting-Host: 71.136.233.222 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1248814626 14711 127.0.0.1 (28 Jul 2009 20:57:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 28 Jul 2009 20:57:06 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v37g2000prg.googlegroups.com; posting-host=71.136.233.222; posting-account=XD7nMAkAAAAUcvFxxCbDAfgYkTA2oJDz User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko/2009042513 Ubuntu/8.04 (hardy) Firefox/3.0.10,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.scheme:6120 comp.lang.ada:7383 comp.lang.functional:2485 comp.lang.c++:48430 comp.programming:12075 Date: 2009-07-28T13:57:05-07:00 List-Id: On Jul 18, 7:19=A0am, Andrea Taverna wrote: > 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 relevanc= e: > > 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 > > =A0 =A0 =A0- FreePascal is a safe and modular alternative to C and C++, = =A0but > it is also close to the latter in terms of expressiveness. Moreover it > doesn't seem to have the libraries I need. > =3D=3D>Qualifies for 0,1,2,5. Not sure about 3 and 4 > > =A0 =A0 =A0- 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. =A0 > 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. > =3D=3D> Qualifies for 0,1,2,4,5 and 6. =A0Not sure about 3. > > =A0 =A0 =A0- 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 =A0to hear the experience of other people learnin= g > Ada from the C/Java background. > As for memory management (requirement 4), I heard there are different > takes on the matter: > =A0(a) Ada uses dynamic stack allocation a lot, and in a transparent way, > reducing the need of manual management (MM) > =A0(b) Ada libraries adopt idioms that further simplifies MM issues > =A0(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. > =3D=3D> Qualifies for 0,1,2,3,5 and, partially, 4 > > =A0 =A0 =A0- Modula-3 is simpler/smaller than Ada and has been successful= ly > 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. > =3D=3D> Qualifies for 0,1,2,4,5,6. P.S. I was going to write a 3-sentence reply, but got carried away. I hope this wasn't a troll... My needs are similar to yours, and I've been looking for better languages and learning them for years. In summary: everything sucks, when you look close enough. OCaml should probably be your #1 choice (about 2x slower than C usually, single core). Has its own flaws (Google "Ocaml sucks") Ada is also 2x slower, but less suitable for your purposes (verbose, less memory safe than OCaml, free compilers produce GPL-only code) Haskell is good for prototyping, and performance on par with C can be achieved (but not reliably, at the cost of writing code 10x more terrible than C: look at the crap in the shootout). Java: 1.5x slower than C as a rule of thumb. Safe, verbose, repetitive, overengineered. Some stuff you get for free with C++ and OCaml ("clone") or in OCaml ("marshalling"), you have to write by hand in Java for every single class. C++: learning curve and safety are the main problems. I'm way past the former, and I use Visual Studio Debug mode (I develop cross-platform code) when there is any sign of memory problems (not frequent), but it's still not completely safe. Gambit-C Scheme (one of the best of LISPs, IMO): about 2x slower than C (single core only), but you have to work to get within 2x (unlike OCaml), and if you want it fast, it can't be safe (switch controlled). The others you mention are dead, with all the implications. (replaced dead NGs with more relevant ones)