Re: Ask for explanation -- possibly repeated

From: Damien Doligez (
Date: Sat Dec 11 1999 - 19:27:50 MET

Date: Sat, 11 Dec 1999 19:27:50 +0100
From: Damien Doligez <>
Message-Id: <>
Subject: Re: Ask for explanation -- possibly repeated

>From: Benoit de Boursetty <>
># let translate_tree =
> let rec aux father (Classical_node (data, sons)) =
> let rec this_node = Node (father, data,
> (aux (Some this_node))
> sons)
> in this_node
> in aux None
>but of course this doesn't work ("This kind of expression is not allowed
>as right-hand side of `let rec'", as they say) and I understand why. It's
>because the contents of "this_node", not yet defined, could be looked at
>in function "aux". In fact this is a correct algorithm only because
>argument "father" is not accessed to in function "aux".

That's exactly right.

>So, is there an applicative workaround? I know how to do it with mutable
>values / references, but...

I don't think you can do it with the current system. We would need to
do some kind of compile-time analysis to make sure the code is safe
before the compiler would accept this code. It's not clear that we
have the manpower needed to implement this kind of feature.

-- Damien

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:29 MET