From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA16171; Wed, 6 Jun 2001 21:32:18 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA15531 for ; Wed, 6 Jun 2001 21:32:17 +0200 (MET DST) Received: from smtp7.xs4all.nl (smtp7.xs4all.nl [194.109.127.133]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f56JWHL25583 for ; Wed, 6 Jun 2001 21:32:17 +0200 (MET DST) Received: from beertje.william.bogus (williamc.xs4all.nl [213.84.56.92]) by smtp7.xs4all.nl (8.9.3/8.9.3) with ESMTP id VAA12390; Wed, 6 Jun 2001 21:32:15 +0200 (CEST) Received: (from williamc@localhost) by beertje.william.bogus (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) id f56JaH621627; Wed, 6 Jun 2001 21:36:17 +0200 X-Authentication-Warning: beertje.william.bogus: williamc set sender to williamc@paneris.org using -f From: William Chesters MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15134.34352.642598.605606@beertje.william.bogus> Date: Wed, 6 Jun 2001 21:36:16 +0200 (CEST) To: caml-list@inria.fr Subject: [Caml-list] ocaml complexity In-Reply-To: <20010606095041.A93623@caddr.com> References: <20010606095041.A93623@caddr.com> X-Mailer: VM 6.75 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Miles Egan writes: > Of all the functional languages, Ocaml seems to me the most pragmatic and most > useful for everyday programming, but I wonder if it's within the grasp of the > everyday user. I know a lot of fairly amateur C++ programmers who get by with a > small subset of the language, but it seems more difficult to limit oneself to a > small subset of Ocaml. > Have others had similar experiences? I suspect most of the readers of this list > are better-than-average programmers. How difficult have you found it to be to > teach Ocaml to your colleagues? Any suggestions on a simple pedagogy for > bringing more junior people abreast of subjects as esoteric as polymorphic > recursive types? Objectively, C++ is much harder to learn than ocaml and you have to be _brilliant_ to make the most of it without getting into trouble. The point surely is that people are more familiar, or at least feel embarrassed about being unfamiliar, with the _jargon_ of C++ as against that of ocaml. Try this table: ocaml closures \approx anonymous classes with one "virtual operator ()" method ocaml sum types \approx C union with attached variant code ocaml polymorphic types \approx generic types via templates -- but no worries about template instantiation, or bloat, or having to learn about the STL! or \approx void * pointers in C -- but with typechecking of course ocaml recursive types = C++ recursive types -- but less confusing---try explaining to a junior programmer what does and does not provoke "incomplete type not allowed" in templatey C++ code ocaml functors, or paramaterised modules, \approx C++ templates -- but in ocaml you get to give signatures, hooray (typename anyone???) ocaml classes \approx C++ classes in which all methods are virtual The really big cultural shift is to think in recursive not iterative terms. I really don't know how to teach that or even explain why it's sometimes a nice way to look at things. But of course in a multiparadigm language (like ocaml or, well, C++) that's more a matter what you do with the language rather than the language per se. Another thing that throws people, strangely, is the sheer conciseness of functional languages---even ocaml (let alone Clean). Finally I think there is a hard core of people who cannot understand a language until they know how it is implemented. In fact ocaml is implemented in a very machine-friendly way (which is why it's so fast and practical). Maybe it's a useful exercise to write out equivalent C---just as it's a great way of explaining C++ to people. ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr