From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.6 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 8588DBC68 for ; Sat, 30 Sep 2006 21:26:55 +0200 (CEST) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.186]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k8UJQsaM022304 for ; Sat, 30 Sep 2006 21:26:55 +0200 Received: by nf-out-0910.google.com with SMTP id y38so1260210nfb for ; Sat, 30 Sep 2006 12:26:54 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=DoBZI1gAecrAst608eLZoUcLr/u355o+DBMRF4wMNGflEhBhIVpXyZwWRb4eu3Tydpr6KibJHV0qpjesqrwl7S7MEQkkWAi6zfCkzgH6XUN2lOUXPkXMASt5v2FsbYPcsUi6Hxr8giHRu/5NTlx83ja+iUSEAVszYT0z2ZKlu0Y= Received: by 10.48.210.20 with SMTP id i20mr1154104nfg; Sat, 30 Sep 2006 12:26:54 -0700 (PDT) Received: by 10.49.32.12 with HTTP; Sat, 30 Sep 2006 12:26:54 -0700 (PDT) Message-ID: Date: Sat, 30 Sep 2006 21:26:54 +0200 From: Tom To: "Diego Olivier FERNANDEZ PONS" Subject: Re: [Caml-list] More problems with memoization Cc: caml-list@inria.fr In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_27088_22412927.1159644414690" References: <20060930200125.bjpzgnh7kkkogkgk@webmail.etu.upmc.fr> X-j-chkmail-Score: MSGID : 451EC4FE.003 on discorde : j-chkmail score : X : 0/20 1 X-Miltered: at discorde with ID 451EC4FE.003 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; memoization:01 ocaml:01 inference:01 ocaml:01 inference:01 generalizing:01 generalizing:01 polymorphic:01 polymorphic:01 caml-list:01 problem:05 problem:05 incorrect:05 incorrect:05 infer:07 X-Attachments: cset="UTF-8" cset="UTF-8" ------=_Part_27088_22412927.1159644414690 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline > > > > Well, the problem is, that the ocaml type inference forbids a function to > return a polymorphic value, so the type of make_mem' is only ('_a -> '_b) > -> '_a -> '_b. So the right thing to do here (as this type is, obviously, > incorrect) is to use Obj.magic: I'm sorry, the OCaml type inference is correct to infer the type ('_a -> '_b) -> '_a -> '_b here, but I believe that there can be no error caused generalizing it. ------=_Part_27088_22412927.1159644414690 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline


Well, the problem is, that the ocaml type inference forbids a function to return a polymorphic value, so the type of make_mem' is only ('_a -> '_b) -> '_a -> '_b. So the right thing to do here (as this type is, obviously, incorrect) is to use Obj.magic:


I'm sorry, the OCaml  type inference is correct to infer the type ('_a -> '_b) -> '_a -> '_b here, but I believe that there can be no error caused generalizing it.


------=_Part_27088_22412927.1159644414690--