From: Jeremy Yallop <jeremy.yallop@ed.ac.uk>
To: Virgile Prevosto <virgile.prevosto@m4x.org>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] let rec and polymorphic functions
Date: Wed, 27 Jun 2007 14:00:02 +0100 [thread overview]
Message-ID: <46825F52.50704@ed.ac.uk> (raw)
In-Reply-To: <20070627140054.68bec31a@localhost>
Virgile Prevosto wrote:
> Le mer 27 jun 2007 12:12:34 CEST,
> Jeremy Yallop <jeremy.yallop@ed.ac.uk> a écrit :
>> OCaml seems a little inconsistent here, actually. The application
>> `id 0' is only valid as the rhs of let rec because the compiler can
>
> Well, it just seems that Ocaml performs type inference before checking
> the validity of the recursive definition. If you give a well-typed
> term, it will complain about a forbidden rhs of let rec:
You're right; I'd overestimated the extent of the analysis. Note that
applications on the rhs of let rec are acceptable if there's no
recursion at all involved in the application:
let id x = x in
let rec f = id id
and g x = g (f x)
in g
Jeremy.
>
> Objective Caml version 3.10.0
>
> # let rec id = fun x -> x and _foo = id 0 in id 1;;
> This kind of expression is not allowed as right-hand side of `let rec'
next prev parent reply other threads:[~2007-06-27 13:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070627100004.9E0DABC73@yquem.inria.fr>
2007-06-27 10:24 ` David Allsopp
2007-06-27 11:12 ` Jeremy Yallop
2007-06-27 11:29 ` David Allsopp
2007-06-27 12:00 ` Virgile Prevosto
2007-06-27 13:00 ` Jeremy Yallop [this message]
2007-06-27 13:12 ` Jon Harrop
2007-06-27 8:40 David Allsopp
2007-06-27 9:05 ` [Caml-list] " Jon Harrop
2007-06-27 10:14 ` Arnaud Spiwack
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=46825F52.50704@ed.ac.uk \
--to=jeremy.yallop@ed.ac.uk \
--cc=caml-list@yquem.inria.fr \
--cc=virgile.prevosto@m4x.org \
/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