Steve Lindsay wrote:

> While I would agree that catching any bugs asap is a good thing, I
> find that typos and the like are not the problems that are causing me
> most grief (crappy logic, crappy requirements, not enough time, other
> developers writing crappy code, etc are more likely to cause me
> problems).

I recently worked on a quite large piece of Python code which I 
inherited without any tests. The only way to test it was to run it
which took 10-15 minutes.

While I was working on this I was constantly finding that little
bugs that an Ocaml/Haskell/Ada/Pascal etc compiler would have found
were killing me at run time. It was a royal PITA.

<rearranged your post slightly>

> Erik, I've never used ocaml (and know very little about it).

I spoke at SLUG about it. Slides here:

    http://www.mega-nerd.com/tmp/firstimp-ocaml.pdf

An Ocaml tutorial is here:

    http://www.ocaml-tutorial.org/

> Would you
> be able to evaluate it against some of the points I've raised above,
> particularly in comparison to python (I'm assuming you've used python
> based on your criticism)?
>
> Python works for me because:
> 
> a) i (and others) write less code because the language is very
> expressive. therefore less bugs

I would say that for pure code (ie not using the excellent Python
libraries) Ocaml will require slightly less LOC than Python.

> b) i (and others) write less code because there are heaps of modules

The Ocaml libraries are not as extensive, comprehensive or as well
documented as those of Python. There are however tasks where even 
the Python libraries won't help you.

> c) i write code and it tends to work first or second go (which says
> way more about python than it does about my coding ability). I don't
> have to fight the language, and don't often think "why did they do it
> that way?"

The thing I have found with Ocaml and many others say about Haskell
is that if it compiles its usually right.

> d) the code tends to be easy to read (both my code and the code in
> standard modules etc.)

Once you get around Ocaml's slight weird syntax this does apply.

> e) i don't have to look up the documentation each time I try something
> slightly new (I can keep a large chunk of the language in my head or I
> can work it out by playing around in the interpreter for a few
> minutes)

Ocaml also has a command line interpreter for experimentation. There
are also bytecode and native-code compilers.

> f) actually I'll mention the interpreter again, it seems such a simple
> thing but the number of times I've not known how to use a module but
> worked it out in the interpreter using a combination of "dir", "help"
> and "__doc__" in a short period of time makes it worth mentioning as a
> point on it's own

The Ocaml documentation is a little dry and not up the same standard as
Python.

However, there are some tasks for which Ocaml is a far better fit than 
Python. For me those would be computer algebra systems and compilers.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"Whenever the C++ language designers had two competing ideas as to
how they should solve some problem, they said, "OK, we'll do them
both". So the language is too baroque for my taste." -- Donald E Knuth
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to