From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 465CE7ED26 for ; Fri, 25 May 2012 07:47:39 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuABAJMcv0/RVde2kGdsb2JhbABEhTSvRggiAQEBAQkJDQcUBCOCFQEBAQQSAg8EEQgBGxwBAQMMBgULAwoCAgUWCwICCQMCAQIBDwIRAQUBHAYNAQUCAQEXB4dcAQMLAZ0PCQOLUlCCcIRuChknDVeIcQEFDIEYiHphhDSBEgOVGIp3gx49hAA X-IronPort-AV: E=Sophos;i="4.75,655,1330902000"; d="scan'208";a="145158194" Received: from mail-ey0-f182.google.com ([209.85.215.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 25 May 2012 07:47:38 +0200 Received: by eabm6 with SMTP id m6so157788eab.27 for ; Thu, 24 May 2012 22:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=EUm9HbxofImoLUDsb9u4QORd5K9sfPhcPWRq2IuSA6A=; b=PjX24CIdTFcqAbATdJi08UbwTSpRU3AYh+eBiX5t343AadQFoLY+3JZkCK6wadhwNe fTqNKy+HBYlmGWLjZTIjIqHOnRpP2YDFopBH/sZm+0cBuO3wXFBK5zvHiREWQGKRoVqt AigHK/VlpBla67RaIdmMjA4xlIzxeLZ2g0RErGkqxDj6mMOKNpvz9nPR/f5bhDiSZViK aOUkRL3mnvh5kGCuqja8K1gXk/yiLKdIszsyRKuL6YvTV4WUBQHaMuvw1bYfbgah/yRI RJjWarzkH+Q9e4mLNxUN83L+3RMRaxMcVBw4qQQDSf6N9XkaIVjvtUHNR+pWbpH3ERoH kZSg== Received: by 10.14.127.201 with SMTP id d49mr394235eei.52.1337924857873; Thu, 24 May 2012 22:47:37 -0700 (PDT) Received: from ?IPv6:2a01:e35:2f37:f210:5e26:aff:fe0c:c1d8? ([2a01:e35:2f37:f210:5e26:aff:fe0c:c1d8]) by mx.google.com with ESMTPS id z5sm3241450eem.3.2012.05.24.22.47.34 (version=SSLv3 cipher=OTHER); Thu, 24 May 2012 22:47:36 -0700 (PDT) Message-ID: <4FBF1CF4.8030003@gmail.com> Date: Fri, 25 May 2012 07:47:32 +0200 From: Jonathan Protzenko User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/15.0 Thunderbird/15.0a1 MIME-Version: 1.0 To: Philippe Wang CC: Caml List , bob zhang References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] A weird typing error FWIW it type-checks on a recent trunk build. jonathan On Fri 25 May 2012 12:17:33 AM CEST, Philippe Wang wrote: > Hi, > > I re-wrote your program, twice. > > First time: The actual problem was submerged... so I removed the > irrelevant code. > It became: > > type 'a twice = 'a > class map = object ((self : 'self_type)) > method twice : 'a0 'b0. ('self_type -> 'a0 -> 'b0) -> 'a0 twice -> 'b0 twice = > fun mf_a -> mf_a self > end > > => ocamlc points a surprising error at line 1. I don't quite understand... > > Second time: well, line 1 seems fine to me. I added some missing parameters. > It became: > > type 'a twice = 'a > class map = > object ((self : 's)) > method twice : 'a0 'b0. ('s -> 'a0 -> 'b0) -> 'a0 twice -> 'b0 twice = > fun mf_a x -> mf_a (self : 's) (x: 'a0 twice) > end > > => ocamlc points the same error, but at line 5, which is a lot better, > much less weird... > Well, kind of same error: the weird (buggy) part of the message is > removed, the important part is kept. > > > And now... I just don't know why it doesn't type-check. All I have > left to say is that I hate encoding data into type names. It's fun > when it works. It's hell otherwise. > > I'm curious to understand the solution of this weird problem, if > someone unravels it. > > Cheers. > Philippe Wang > > > > On Thu, May 24, 2012 at 7:55 PM, bob zhang wrote: >> >> Hi, list >> I came across a weird type error. >> The error message is "Error: The implementation type_error_ppo.ml >> does not match the interface (inferred signature):" >> I attached the file >> Many thanks >> >> -- >> -- Bob >