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.0 required=5.0 tests=none autolearn=disabled version=3.1.3 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 3E457BC69 for ; Sat, 29 Dec 2007 02:19:47 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.24,218,1196636400"; d="scan'208";a="6119370" Received: from smtpoutm.mac.com ([17.148.16.67]) by mail1-smtp-roc.national.inria.fr with ESMTP; 29 Dec 2007 02:19:46 +0100 Received: from mac.com (asmtp002-s [10.150.69.65]) by smtpoutm.mac.com (Xserve/smtpout004/MantshX 4.0) with ESMTP id lBT1JjVi021907 for ; Fri, 28 Dec 2007 17:19:45 -0800 (PST) Received: from [10.62.243.100] (mobile-032-151-114-016.mycingular.net [32.151.114.16] (may be forged)) (authenticated bits=0) by mac.com (Xserve/asmtp002/MantshX 4.0) with ESMTP id lBT1JfCe028141 for ; Fri, 28 Dec 2007 17:19:43 -0800 (PST) Message-Id: <1A5E39DC-CCAE-48B2-AC06-C671143A6C50@mac.com> From: Gordon Henriksen To: "caml-list@yquem.inria.fr" In-Reply-To: <200712290027.26471.jon@ffconsultancy.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes X-Mailer: iPhone Mail (3B48b) Mime-Version: 1.0 (iPhone Mail 3B48b) Subject: Re: [Caml-list] "OCaml gives you only monomorphic methods in classes." Content-Transfer-Encoding: 7bit Date: Fri, 28 Dec 2007 18:19:53 -0700 References: <200712282337.23952.jon@ffconsultancy.com> <4F8745F4-A1C4-4896-BC1E-0C10E82BFB02@mac.com> <200712290027.26471.jon@ffconsultancy.com> X-Spam: no; 0.00; ocaml:01 foo:01 overloading:01 inference:01 foo:01 statically:01 beginner's:01 ocaml:01 bug:01 28,:98 2007,:98 frog:98 beginners:01 wrote:01 wrote:01 Oh, were you proposing a language feature? In that case, consider: let bar x = foo x How to compile that? - Gordon On Dec 28, 2007, at 17:27, Jon Harrop wrote: > On Friday 28 December 2007 23:55:32 Gordon Henriksen wrote: >> Jon, consider the case of Java or C++ method (and function) >> overloading. This form of static dispatch is quite distinct from >> virtual method dispatch, and is indeed at odds with type inference. > > I see. Still, the solution seems easy enough. Just treat the > overloaded types > as part of the function name: > > foo(int n) > foo(float x) > foo(string s) > > becomes: > > foo_int n > foo_float x > foo_string s > > When you come across: > > foo(a) > > you look up the statically inferred type of "a" and just bail if it > fails to > match any of the overloads. > > Generics are left alone: > > foo(T x) > > becomes: > > foo (x : 'T) > > Would that work? > > -- > Dr Jon D Harrop, Flying Frog Consultancy Ltd. > http://www.ffconsultancy.com/products/?e > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs