Re: CAML Light system functions etc.

John Harrison (jharriso@ra.abo.fi)
Mon, 20 Nov 1995 14:04:13 +0200

Message-Id: <199511201204.OAA20531@tanichka.abo.fi>
To: Xavier Leroy <Xavier.Leroy@inria.fr>
Subject: Re: CAML Light system functions etc.
Date: Mon, 20 Nov 1995 14:04:13 +0200
From: John Harrison <jharriso@ra.abo.fi>

| > (1) Is there an interface to "tempnam" or something similar? (For creating
| > unique temporary filenames). I looked in the "unix" library but couldn't
| > find anything -- I think it'd be a convenient addition.
|
| It is a SMOP (Small Matter Of Programming). Here is the function I use:

Yes, I ended up doing something using the PID. But then most library
functions are a SMOP; it still seems reasonable to provide the ones that
users are going to need. At least you and I needed this one.

| > it's neither pleasant nor efficient to always have to worry
| > about signal exceptions popping up.
|
| Shall I read this as ``I use (try ... with _ -> ...) all the time because
| I'm too sloppy to figure out exactly which exceptions I should trap'' ?
| That's a dangerous thing to do, since any heap allocation can trigger
| the Out_of_memory exception.

That's an all-too-accurate reading! Except that I could perfectly well have
a common exception "MYERR" and just use "try ... with MYERR(_) -> ...". I
wouldn't object to the extra typing, but I guess it would be significantly
less efficient. Is that true? I suppose I could try it and find out.

| > (3) Is there some hook to allow a user-defined function to be called after
| > the evaluation and printing of each toplevel phrase? This would be nice for
| > reporting run statistics etc.
|
| No, there isn't.

Well, since you excel at reading between the lines, you can read my question
as "what a great idea it would be to add some hook... wouldn't it?" My guess
is that it would be easy for a CAML-Light expert to add, since the
interpreter's read-eval-print loop itself seems to be written in CAML.

Cheers,

John.