Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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)

http://caml.inria.fr/camlp4/manual/
http://wwwtcs.inf.tu-dresden.de/~tews/htmlman-3.07/libref/Lazy.html

Kenn

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 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

-------------------
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