From: William Chesters <williamc@paneris.org>
To: caml-list@inria.fr
Subject: [Caml-list] ocaml complexity
Date: Wed, 6 Jun 2001 21:36:16 +0200 (CEST) [thread overview]
Message-ID: <15134.34352.642598.605606@beertje.william.bogus> (raw)
In-Reply-To: <20010606095041.A93623@caddr.com>
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
next prev parent reply other threads:[~2001-06-06 19:32 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-06 16:50 Miles Egan
2001-06-06 17:30 ` Chris Hecker
2001-06-06 18:25 ` Charles Martin
2001-06-06 19:27 ` Michael Hicks
2001-06-06 21:15 ` David Fox
2001-06-07 12:25 ` FabienFleutot
2001-06-08 0:27 ` Miles Egan
2001-06-06 19:36 ` William Chesters [this message]
2001-06-06 19:55 ` John Max Skaller
2001-06-06 20:06 ` William Chesters
2001-06-07 16:30 ` John Max Skaller
2001-06-08 0:32 ` Miles Egan
2001-06-08 0:56 ` David Fox
2001-06-07 7:35 ` wester
2001-06-07 17:27 ` John Max Skaller
2001-06-07 8:58 leary
2001-06-07 18:29 ` Jonathan Coupe
2001-06-08 9:41 ` leary
2001-06-08 12:27 ` Jonathan Coupe
2001-06-08 20:22 ` Chris Hecker
2001-06-08 20:31 ` Miles Egan
2001-06-08 22:17 ` Jonathan Coupe
2001-06-08 22:18 ` Miles Egan
2001-06-11 14:05 ` Pierre Weis
2001-06-09 19:41 ` John Max Skaller
2001-06-08 22:59 ` David Fox
2001-06-09 0:43 ` leary
2001-06-09 1:09 ` Mark Wotton
2001-06-09 8:36 ` Markus Mottl
2001-06-09 20:58 ` John Max Skaller
2001-06-08 22:46 ` leary
2001-06-09 1:18 ` David Fox
2001-06-12 14:17 ` John Max Skaller
2001-06-13 15:21 ` Brian Rogoff
2001-06-13 20:32 ` leary
2001-06-13 22:58 ` Johann Höchtl
2001-06-13 21:18 ` John Max Skaller
2001-06-09 22:32 ` Jonathan Coupe
2001-06-11 0:20 ` leary
2001-06-11 20:33 Arturo Borquez
2001-06-11 21:17 ` Miles Egan
2001-06-12 7:19 ` wester
2001-06-13 21:04 David Gurr
2001-06-13 23:13 ` leary
2001-06-13 23:19 ` Brian Rogoff
2001-06-15 13:28 ` Tore Lund
2001-06-15 14:03 ` Nils Goesche
2001-06-15 14:54 ` Xavier Leroy
2001-06-15 15:14 ` Jonathan Coupe
2001-06-15 15:23 ` Nils Goesche
2001-06-15 17:38 ` Sven LUTHER
2001-06-15 20:36 ` Remi VANICAT
2001-06-15 14:16 ` Doug Bagley
2001-06-28 12:54 ` Didier Remy
2001-06-28 18:31 ` Brian Rogoff
2001-06-14 16:04 John R Harrison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15134.34352.642598.605606@beertje.william.bogus \
--to=williamc@paneris.org \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox