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 Path: g2news2.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.eiffel,comp.lang.ada,comp.lang.modula3,comp.programming Subject: Re: Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3? Date: Tue, 21 Jul 2009 19:17:58 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <51617b48-400b-4296-9362-78aa712bb6b2@a7g2000yqk.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: pcls6.std.com 1248218290 20287 192.74.137.71 (21 Jul 2009 23:18:10 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 21 Jul 2009 23:18:10 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:AMv2QK49wMZnwcA3QekVks3W2Fs= Xref: g2news2.google.com comp.lang.eiffel:384 comp.lang.ada:7259 comp.lang.modula3:81 comp.programming:11962 Date: 2009-07-21T19:17:58-04:00 List-Id: Martin writes: > On Jul 21, 3:09�pm, Jon Harrop wrote: >> I do not doubt that. My concern about Ada is primarily that it prohibits >> many conventional and hugely-productive mainstream abstractions like >> first-class lexical closures. Those are particularly beneficial in the >> context of scientific computing. > > But I'm afraid it does...20 years ago it didn't. No, that's not quite right. Ada 2005 does not have "first-class lexical closures", as Jon said. Ada has "downward closures" (sometimes called "inward closures"). In Ada, you can pass a nested function to a non-nested function. You cannot return a nested function from the function containing it. Both are required, to make them "first class" (or "full closures"), as in OCaml, Lisp, Haskell, etc. I'd say downward closures give you at least 80% of what one might want from closures. Unfortunately, the syntax for downward closures is pretty awful in Ada, compared to (e.g.) OCaml. There are proposals to make it better in the next version of Ada. It is unlikely that the next version of Ada will have full closures. (Of course, you can always simulate full closures in Ada, using tagged and class-wide types, but it can get pretty ugly.) I'd still choose Ada over OCaml for what the OP wants to do. E.g. Ada's ability to have multiple user-defined integer types seems like a trivial thing, but in practice it is hugely beneficial. For example, suppose I have an array containing indices into another array. Using a different index type for the two arrays makes the code clear -- when I see an integer variable, I can immediately tell from its type which array it is intended to index. Both OCaml and Ada are pretty good language designs -- far better than some of the more popular languages. Both have advantages and disadvantages. I would not choose any version/dialect of Pascal or Modula for anything, these days. Ada is strictly better. Eiffel is a nice language design, but suffers from some other problems. By the way, some of the "design by contract" stuff from Eiffel has already been implemented in GNAT (the free-software Ada compiler), and even more is being considered for the next version of Ada. >> > Sounds pretty scientific to me...and there are plenty others, e.g. >> > some Astrophysics work [http://homepage.univie.ac.at/martin.stift/]. >> >> Might be interesting to translate some of the examples in those lecture >> notes from Ada to a more modern language. Jon, why do you use "modern" to mean "good"? They are not synonymous! For example, closures are good, but they were invented a long time ago -- they're certainly not "modern". If you said, "Might be interesting to translate some of the examples in those lecture notes from Ada to a language with full closures", then I'd agree -- it would be interesting indeed. - Bob P.S. You should know my potential biases: I was heavily involved in the design of Ada 95, and somewhat involved in the design of Ada 2005, and continue to be somewhat involved in the ongoing design of the next version. And I currently work for AdaCore.