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 (14:47)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] tail rec
On Sat, May 19, 2007 at 04:28:27PM +0200, Oliver Bandel wrote:
> On Sat, May 19, 2007 at 12:56:05PM +1000, skaller wrote:
> > I have a silly idea. Introduce a new construction:
> > 
> > let tailrec f .. 
> > 
> > This is the same as let rec except it checks every direct call to f
> > is in tail position (and bombs out the compiler if not).
> > 
> > [Maybe this can be done with camlp4, though I think it might
> > be hard?]
> > 
> > I think this could be useful for newbies learning functional
> > programming, and perhaps even experts looking for performance
> > issues.
> [...]
> I think this is blocking understanding of how ressources
> are allocated, when one uses a certain style of programming
> and datastructures.

Forget these words: I misunderstood your email,
because I did not read until end before I answered.
Sorry for the unnecessary traffic.

I thought you want to automatically *convert*
code to tailrec-code. Even if this would
also be a fine thing, it could block understanding,
as mentioned above.

But you only want to have warnings...
...that might be a good helper.
But it might also be annoying?
Such warnings should be off per default, IMHO.