Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlbuild rule with recursive action
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: DooMeeR <d@d...>
Subject: Re: [Caml-list] ocamlbuild rule with recursive action
Daniel Bünzli a écrit :
> Hello,
> 
> Is it possible to define a rule with an action that is performed 
> repeatedly until a condition is reached ?
> 
> Best,
> 
> Daniel

Well, you can define a rule like this :

rule ~prod: "%.rec" (fun env build ->
   let x = env "%2.rec" in (* a new fresh name *)
   if some condition then build x else Nop)

When your rule is executed, for exemple to produce "toto.rec", it will 
(if some condition) first produce "toto2.rec", which will produce 
"toto22.rec", and so on until some condition is false.

I didn't try it though.

-- 
Romain Bardou