From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 CA2BABC57 for ; Mon, 1 Mar 2010 13:28:31 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.49,560,1262559600"; d="scan'208";a="53794021" Received: from aspirine.inria.fr (HELO [128.93.60.41]) ([128.93.60.41]) by mail1-relais-roc.national.inria.fr with ESMTP; 01 Mar 2010 13:28:31 +0100 Message-ID: <4B8BB2EF.1010008@glondu.net> Date: Mon, 01 Mar 2010 13:28:31 +0100 From: =?UTF-8?B?U3TDqXBoYW5lIEdsb25kdQ==?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: guillaume.yziquel@citycable.ch Cc: OCaml List Subject: Re: [Caml-list] Recursive subtyping issue References: <4B887AED.3090005@citycable.ch> <4B88F32C.3050701@citycable.ch> <87k4tyoq3m.fsf@frosties.localdomain> <4B891A0C.604@citycable.ch> <76EDF2F2-8B02-4C97-B083-EC74630D8ECA@mpi-sws.org> <4B896026.2070805@citycable.ch> <4B89780E.5080305@citycable.ch> <4B898179.1000600@citycable.ch> <4B8B9D15.7070300@glondu.net> <4B8BA350.8090404@citycable.ch> In-Reply-To: <4B8BA350.8090404@citycable.ch> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; recursive:01 subtyping:01 guillaume:01 subtyping:01 fwiw:01 bindings:01 runtime:01 untyped:01 annotations:01 phane:98 steph:98 phane:98 syntactic:01 caml-list:01 functions:01 Guillaume Yziquel a écrit : > Because subtyping seems more efficient than applying a noop function. > And this code might run really often, so I do not like very much the > idea of having noop functions running really often. FWIW, I don't think you have any penalty if you declare your identities as externals like Obj.{repr,obj,magic}. Yuk, some might say... but we are in the context of bindings to other languages anyway. > Moreover, having conversion functions is not really handy, from a > syntactic point of view: It's quite convenient to write something like > > let f : string -> obj :> string -> float t = blah blah blah... > > than doing the explicit, runtime, casting in the definition of f. It's more convenient for me write letters and parentheses than the symbol ":>" :-) IIUC, these conversion function are not to be used often, are they? What you want is the equivalent of Obj.{repr,obj}, but for values of some other language, right? Are you planning to leak your "tau", "typed" and "untyped" types out of the module? If so, inferred types are likely to refer to those, which might be very confusing (unless you resort to a lot of type annotations). If not, you'll have to use explicitly the coercion functions outside of the module anyway. -- Stéphane