From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA15645 for caml-redistribution; Sun, 12 Dec 1999 23:11:56 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA31045 for ; Sat, 11 Dec 1999 19:27:52 +0100 (MET) Received: from tobago.inria.fr (tobago.inria.fr [128.93.8.21]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id TAA26657 for ; Sat, 11 Dec 1999 19:27:51 +0100 (MET) Received: (from doligez@localhost) by tobago.inria.fr (8.6.10/8.6.6) id TAA06475 for caml-list@inria.fr; Sat, 11 Dec 1999 19:27:50 +0100 Date: Sat, 11 Dec 1999 19:27:50 +0100 From: Damien Doligez Message-Id: <199912111827.TAA06475@tobago.inria.fr> To: caml-list@inria.fr Subject: Re: Ask for explanation -- possibly repeated Sender: weis >From: Benoit de Boursetty > ># let translate_tree = > let rec aux father (Classical_node (data, sons)) = > let rec this_node = Node (father, data, > List.map > (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