English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
tail rec
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-05-19 (21:55)
From: Erik de Castro Lopo <mle+ocaml@m...>
Subject: Re: [Caml-list] tail rec
Jonathan Bryant wrote:

> Does the compiler optimize the calls (f x) and (g x) into tail  
> calls?  If so, how would the
> 
> let railrec f x = ...
> let tailrec g x = ...
> let tailrec h x = ...
> 
> syntax handle/help this?  Or would it hinder it?

The new syntax neither helps nor hinders. The tailrec directive
requests that the compile complain if a function marked as "tailrec"
cannot be made tail recursice.

Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"I have found that Big Design Up Front environments attract people who
want to talk about software development, while iterative environments
attract people who want to develop software. Is it any surpise that in
companies where BDUF is predominant, nobody wants to stoop to coding?
Everyone wants to be an 'architect' or a 'Business Analyst' or a 
'Product Manager'." -- Reg Braithwaite