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
[Caml-list] Automatic wrapper generator
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-18 (21:08)
From: Kenneth Knowles <kknowles@b...>
Subject: Re: [Caml-list] Functional critical section

With Camlp4 you may be able to do this via pre-processing.  Otherwise you could
do it with lazy evaluation, supported by the Lazy module in the standard
library.  An inefficient lazy evaluation can be had be just adding an additional
unit argument to your function.  (lablGL does something like this, though I'm
not sure of their motivations)


On Tue, May 18, 2004 at 04:10:44PM -0400, SWAMPY wrote:
> Hello!
>    I'm very new to ocaml, and I'm trying to figure out how
> to do something that may or may not actually be possible.
> Any suggestions?
>     I'd like to write
>         <name> <expr>
>     as an expression, and have this evaluate <expr> first
> evaluating fixed expression A, and then after evaluting
> <expr> evaluate fixed expression B.
>     Then, I could do something like:
>     critical (threadsafeFunction arg1 arg2 arg3)
>     and have this do the equivalent of
>     Mutex.lock someMutex; let tmp = threadsafeFunction arg1
> arg2 arg3; Mutex.unlock someMutex; tmp;;
>     Is this sort of thing possible?  In general I'm
> interested in techniques I could use to wrap
> imperative-biased parts of the library to more functional
> constructs.
>     Cheers,
>     David J. Trombley
> -------------------
> To unsubscribe, mail Archives:
> Bug reports: FAQ:
> Beginner's list:

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: