Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Ocaml compiler features
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-01-16 (17:47)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Ocaml compiler features
On Tue, 2007-01-16 at 16:00 +0100, Vincent Hanquez wrote:

> Does you felix program have threads ? or lots of file descriptor ? or
> has to stay up for a long period of time ? or use side effect quite
> extensively ?
> Absolutely not, it's a compiler that doesn't need much of these stuff.
> And even then, you can most of the time just rely on exit(3) to cleanup
> since it's a short live service.


> What about a server now ? add threads in the mix where all mutex need to
> be properly unlocked, add also function with weird side effects that
> don't have any representation variable at the OCaml level (thus cannot be
> garbage collected), etc...

What about it? C manages to handle all that .. and has no exceptions.

> So please don't generalise your situation which is quite specific
> (compiler) to the whole world of OCaml and open your mind to the fact
> that people has different need/expectation.

Try not to make assumptions about what people know. 
I've been programming for three decades. My mind isn't
closed .. you just don't seem to get that what YOU think
is common practice may actually not be.

> (and that Felix doesn't have exceptions, I couldn't care less. OCaml
> does and there are no going away, so live with it.)

You missed the point. Neither C nor Felix have exceptions, and Ocaml
can be programmed the same way. There's no need for finally
if you program in an 'exception free' style.  

It may be convenient but your claim was that the need was 'common'.
I doubt this. 

I DO agree exceptions, as structured now, are not so good.
They're clumsy, hard to use, and dangerous (if not downright evil).

But adding 'finally' may not be the best solution,
the try/let construction looks better to me.

> > Actually I'm a Python ex-guru, I have two major pieces
> > of software written in it, and I've even *implemented*
> > a Python interpreter .. in Ocaml :)
> Good for you. (interpreter still fall in the compiler category btw)

The interpreter actually needed finalisation, since it used
Ocaml GC instead of Python reference counting. In fact Ocaml
finalisers were more or less added to Ocaml *because* my
project provided a solid use case.

In fact I have used Ocaml in a telco environment .. using
the nice Event module, with many threads, services,
and clients interacting in (soft) real time. That was some
time ago so I can't say if I would have used 'finally'
in that context or not. But typically I do that kind of
thing the C way, which is generally the Ocaml way too:
you propagate return codes from functions using variants
up call chains.

John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: