Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Dynamically evaluating OCaml code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Dynamically evaluating OCaml code
On Thu, 2004-04-08 at 23:37, John Goerzen wrote:

> I'm still relatively new to
> OCaml, having been using it for only a couple of months,

> Basic string processing is also more difficult than a language such as,
> say, Python, where I can say, for instance:

> Also, there is no string_of_char function (I'd have to use fill).

As a newbie, you'll think these omission more serious than
a more seasoned Ocaml programmer, IMHO. The reason is,
most of these things are just *so* easy to define as you want
in Ocaml, compared to other languages.

I've worked with ultra-rich C++ libraries and have nothing
but total criticism of them: there is a function for just about
everything you want to do .. if you can find it in the documentation,
and if it actually works .. and if the documentation is correct ..
and if you can spend hours running test code to determine which
combinations are most efficient ... UGGGG!

I'm not saying you're wrong, just that the problem here
is less than you might expect. Yeah, its a pain writing

let list_of_hashtbl cmp h =
  let x = ref [] in Hashtbl.iter
  (fun k v -> x := (k,v) :: !x)
  h; 
  sort cmp !x

but truly, it didn't take that long to write
(and would be even cuter with a fold .. :D

How many C++ users would write:

	std::copy(ss, se, d)

instead of

	for(p=ss;p!=se;)*d++=*p++;

The BIG advantage Python and C++ have over Ocaml here is that
they have coherent library design concepts. Both Python and C++
have a serialisation (iterator/sequence) concept and one
of associative containers, and both provide syntactic support.
(Python with things like for loops and slices, C++ with STL).

The real problem in Ocaml is that the right way to do this
is functorial polymorphism, which is still pretty bleeding edge.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners