From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 0F217BC37 for ; Sat, 2 Jan 2010 17:25:42 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuoBAKMCP0vRVdvikGdsb2JhbACRQIlHPwEBAQEJCQwHEwOqFoEyg2+GNQECAwWELAQ X-IronPort-AV: E=Sophos;i="4.47,489,1257116400"; d="scan'208";a="53110924" Received: from mail-ew0-f226.google.com ([209.85.219.226]) by mail4-smtp-sop.national.inria.fr with ESMTP; 02 Jan 2010 17:25:26 +0100 Received: by ewy26 with SMTP id 26so11748686ewy.3 for ; Sat, 02 Jan 2010 08:25:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=s9oi8ZhQ6RrBEzjFjCAu4nMeZLPwJnjdJc456jdKkGE=; b=ARpaXB9qBJ/ygjpZlG7nQaCBFxt/1NHmRus6JrkTCxiVRP68WsChG2BxdCqT616i3R 4EWDlyKoHN3TOMsLmeyg/fyFGd6jjbLBznEsKYGq1S4QnsNyZGEcwAk7Rrh5h0islYYs WE6WNznmrxuMyz904V1bDW7qO6K+YDPwH1WJA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=YvJwrUkYmQh32MXxORI2egX1H4rGKtjHd0Tc76vD+3fx3sEvSmtzDatJJWSzva/31E 4dN8YaffZkJXvEmoBNgrDWMonYjBp8wZx8SHZfqITKbYuj8FTehfS6pqCnlIZB4/EX3I VOvpCnsVTuBtaI6RWUAOZOGIcw9ktOwdfYWWA= MIME-Version: 1.0 Received: by 10.216.89.149 with SMTP id c21mr3086560wef.224.1262449525801; Sat, 02 Jan 2010 08:25:25 -0800 (PST) In-Reply-To: References: Date: Sat, 2 Jan 2010 11:25:25 -0500 Message-ID: Subject: Re: value restriction From: Jacques Le Normand To: caml-list caml-list Content-Type: multipart/alternative; boundary=0016e6d7eefa8842f4047c30efb4 X-Spam: no; 0.00; foo:01 baz:01 baz:01 val:01 foo:01 cheers:01 val:01 cheers:01 polymorphic:01 polymorphic:01 wrote:01 wrote:01 caml-list:01 caml-list:01 int:01 --0016e6d7eefa8842f4047c30efb4 Content-Type: text/plain; charset=ISO-8859-1 on another note (but staying very much on the same topic), why won't the following generalize: # let foo = let counter = ref 0 in let bar = !counter in let baz = fun x -> bar in baz val foo : '_a -> int = baz clearly has a polymorphic type, yet foo doesn't. Is there any way around this ? --Jacques L. On Fri, Jan 1, 2010 at 6:05 PM, Jacques Le Normand wrote: > Hello caml-list, > with respect to the value restriction, what exactly constitutes a value? > the textbook definition doesn't seem to hold, since the following > generalizes: > > let f = let x = 1 in fun g h x -> g (h x);; > > while this won't: > > let f () = let x = (fun x -> x) (fun x -> x) in fun g h x -> g (h x);; > > cheers > > --Jacques L. > --0016e6d7eefa8842f4047c30efb4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
on another note (but staying very much on the same topic), why won'= ;t the following generalize:

# let foo =3D=A0
=A0=A0 =A0let counter =A0=3D ref 0 in
=A0=A0 =A0let bar =3D= !counter =A0in
=A0=A0 =A0let baz =3D fun x -> bar
=A0=A0 =A0in
=A0=A0 =A0 =A0baz


val foo : '_= a -> int =3D <fun>


baz cle= arly has a polymorphic type, yet foo doesn't.=A0
Is there any way around this ?

--Jacques L.
On Fri, Jan 1, 2010 at 6:05 PM, Jacques = Le Normand <ra= thereasy@gmail.com> wrote:
Hello caml-list,
with respect to the va= lue restriction, what exactly constitutes a value?
the textbook d= efinition doesn't seem to hold, since the following generalizes:

let f =3D let x =3D 1 in fun g h x -> g (h x);;

while this won't:

let f ()= =3D let x =3D (fun x -> x) (fun x -> x) in fun g h x -> g (h x);;=

cheers

--Jacques L.

--0016e6d7eefa8842f4047c30efb4--