caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Damien Doligez <Damien.Doligez@inria.fr>
To: caml-list@inria.fr
Subject: Re:  Ask for explanation -- possibly repeated
Date: Sat, 11 Dec 1999 19:27:50 +0100	[thread overview]
Message-ID: <199912111827.TAA06475@tobago.inria.fr> (raw)

>From: Benoit de Boursetty <debourse@email.enst.fr>
>
># 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




             reply	other threads:[~1999-12-12 22:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-11 18:27 Damien Doligez [this message]
1999-12-12 22:33 ` Pierre Weis
1999-12-13  0:25   ` Benoit de Boursetty
1999-12-13 16:21     ` Pierre Weis
  -- strict thread matches above, loose matches on Subject: below --
1999-12-08  5:07 Benoit de Boursetty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199912111827.TAA06475@tobago.inria.fr \
    --to=damien.doligez@inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).