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.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 196FCBC69 for ; Fri, 5 Oct 2007 16:02:18 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAD/gBUfAXQImh2dsb2JhbACOOQIBCAop X-IronPort-AV: E=Sophos;i="4.21,236,1188770400"; d="scan'208";a="3797529" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 05 Oct 2007 16:02:17 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l95E2DBL012839 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 5 Oct 2007 16:02:17 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAD/gBUdA6ba9i2dsb2JhbACOOQIBCAQEExEF X-IronPort-AV: E=Sophos;i="4.21,236,1188770400"; d="scan'208";a="17338641" Received: from nf-out-0910.google.com ([64.233.182.189]) by mail4-smtp-sop.national.inria.fr with ESMTP; 05 Oct 2007 16:02:17 +0200 Received: by nf-out-0910.google.com with SMTP id g13so486587nfb for ; Fri, 05 Oct 2007 07:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding:sender; bh=jYR2hKEdyNlFV6+2E1nG1tcEyTzgL58CWliHVw83kfs=; b=lFKEgCo4au0ExjB4YFEQd132z6rQArvv6j6xJ3fSxc5Ofak+1wwUF4xZFL8ATiH4W6z9Of/buiJu8HDUblf1FYYSzNhn+j3TFDydIbo/32eW5kNlNpEwwNF8kxe1JBr5S7L2tSwFt5ozpaj8/ohGx12wJ/GxrkUlZrx4Aqks/Yo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding:sender; b=gD1zteULrhfg4qGhnf3Vwixxr5LEdZi29MgIAYAfrrcCZfY6tct7UrexssnhurGy68M+llD9RJDe6yeNxe53CS/AaOluFit2vzmtextanwHFw0KGLD03Z6w2oIGxd+dvhQs06t7nMNRBk3Nug6sNl4ibl43uWsYKllzk9iF4mM4= Received: by 10.86.81.8 with SMTP id e8mr2499478fgb.1191592935739; Fri, 05 Oct 2007 07:02:15 -0700 (PDT) Received: from ?192.168.0.12? ( [82.235.58.110]) by mx.google.com with ESMTPS id a37sm5556142fkc.2007.10.05.07.02.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 05 Oct 2007 07:02:14 -0700 (PDT) Subject: Re: [Caml-list] Re: Why can't I call a function over a subclass? From: David Teller To: Zheng Li Cc: caml-list@inria.fr In-Reply-To: <87ejg9oms3.fsf@pps.jussieu.fr> References: <28fa90930710050048p3d6f4e8cs8e13d0fe49d296f2@mail.gmail.com> <4705EF58.3040605@bik-gmbh.de> <1191580233.6509.26.camel@Blefuscu> <87ejg9oms3.fsf@pps.jussieu.fr> Content-Type: text/plain Date: Fri, 05 Oct 2007 16:02:11 +0200 Message-Id: <1191592931.6509.33.camel@Blefuscu> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit Sender: David Teller X-Miltered: at discorde with ID 470643E5.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 cheers:01 0200,:01 ens-lyon:01 subtypes:01 val:01 bool:01 polymorphic:01 wrote:01 caml-list:01 writes:01 behaviour:01 expression:02 subclass:03 let:03 Sure. I'm just saying that this default behaviour is disconcerting. In addition to which, while it does appear in the documentation, it's rather well hidden inside section 3.11 "Polymorphic methods" -- even though this is not a method. Cheers, David On Fri, 2007-10-05 at 12:53 +0200, Zheng Li wrote: > David Teller writes: > > I agree with Luca that it's disconcerting. > > When r is a class, I would expect > > > let f (x:r) (y:r) =... > This expression says f accept arguments of type [r], what you mean to say is: f > accept any arguments belong to [r]'s subtypes family. Then say it with > > # let f (x:#r) (y:#r) = x#get_x = y#get_x > val f : #r -> #r -> bool = >