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=0.4 required=5.0 tests=AWL,HTML_MESSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 43F04BC69 for ; Fri, 5 Oct 2007 10:08:13 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAADeOBUfAXQImh2dsb2JhbACCOzaLRwIBCAop X-IronPort-AV: E=Sophos;i="4.21,234,1188770400"; d="scan'208";a="2172596" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 05 Oct 2007 10:08:13 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l95886BB016915 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 5 Oct 2007 10:08:12 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAL6NBUdC+VLsmGdsb2JhbACCOzaLRwIBAQcEBBMY X-IronPort-AV: E=Sophos;i="4.21,234,1188770400"; d="scan'208";a="2408514" Received: from wx-out-0506.google.com ([66.249.82.236]) by mail2-smtp-roc.national.inria.fr with ESMTP; 05 Oct 2007 10:08:12 +0200 Received: by wx-out-0506.google.com with SMTP id h28so441038wxd for ; Fri, 05 Oct 2007 01:08:11 -0700 (PDT) Received: by 10.70.84.6 with SMTP id h6mr18742831wxb.1191571691190; Fri, 05 Oct 2007 01:08:11 -0700 (PDT) Received: by 10.70.83.1 with HTTP; Fri, 5 Oct 2007 01:08:11 -0700 (PDT) Message-ID: <28fa90930710050108k34cff56dge24e1e9c4a01f9bd@mail.gmail.com> Date: Fri, 5 Oct 2007 01:08:11 -0700 From: "Luca de Alfaro" To: "Inria Ocaml Mailing List" Subject: Re: [Caml-list] Why can't I call a function over a subclass? In-Reply-To: <4705EF58.3040605@bik-gmbh.de> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6964_28867524.1191571691190" References: <28fa90930710050048p3d6f4e8cs8e13d0fe49d296f2@mail.gmail.com> <4705EF58.3040605@bik-gmbh.de> X-Miltered: at discorde with ID 4705F0E6.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; superclass:01 ocaml:01 runtime:01 runtime:01 hars:01 hars:01 bik-gmbh:01 typechecker:01 enforces:01 subtypes:01 superclass:01 ocaml:01 bik-gmbh:01 typechecker:01 enforces:01 ------=_Part_6964_28867524.1191571691190 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I don't understand this. I thought the whole idea of oo programming was that you could use a subclass in place of a superclass... I also thought that the strict typing of Ocaml was there to avoid runtime errors, but if so, why does it complain in this situation, when no runtime error can possibly happen? It seems to me that the idea of oo programming is broken for no good reason... Luca On 10/5/07, Florian Hars wrote: > > Luca de Alfaro schrieb: > > The absurdity continues: > > This is not absurd, this is the documented correct behaviuor. > If *you* decide that f must only accept arguments of *exactly* > type r, the typechecker enforces your decision, as it does if > you decide that f may also accept subtypes of r (as long as your > decisions are consistent within he type system). > > Yours, Florian. > ------=_Part_6964_28867524.1191571691190 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I don't understand this.  I thought the whole idea of oo programming was that you could use a subclass in place of a superclass...

I also thought that the strict typing of Ocaml was there to avoid runtime errors, but if so, why does it complain in this situation, when no runtime error can possibly happen?

It seems to me that the idea of oo programming is broken for no good reason...

Luca

On 10/5/07, Florian Hars < hars@bik-gmbh.de> wrote:
Luca de Alfaro schrieb:
> The absurdity continues:

This is not absurd, this is the documented correct behaviuor.
If *you* decide that f must only accept arguments of *exactly*
type r, the typechecker enforces your decision, as it does if
you decide that f may also accept subtypes of r (as long as your
decisions are consistent within he type system).

Yours, Florian.

------=_Part_6964_28867524.1191571691190--