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=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 5A18DBC69 for ; Mon, 25 Jun 2007 05:31:45 +0200 (CEST) Received: from ptb-relay03.plus.net (ptb-relay03.plus.net [212.159.14.214]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5P3ViLP025280 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Mon, 25 Jun 2007 05:31:44 +0200 Received: from [80.229.56.224] (helo=beast.local) by ptb-relay03.plus.net with esmtp (Exim) id 1I2fIb-0000uQ-ET for caml-list@yquem.inria.fr; Mon, 25 Jun 2007 04:31:44 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Execution time of class versus record Date: Mon, 25 Jun 2007 04:25:28 +0100 User-Agent: KMail/1.9.7 References: <467E8A6E.9050700@menta.net> <1182709750.20268.22.camel@localhost.localdomain> <467EBD16.7060303@lix.polytechnique.fr> In-Reply-To: <467EBD16.7060303@lix.polytechnique.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200706250425.28516.jon@ffconsultancy.com> X-Miltered: at discorde with ID 467F3720.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; statically:01 run-time:01 arrays:01 runtime:01 compilation:01 ocaml's:01 orthogonal:01 compilation:01 ocaml:01 variants:01 runtime:01 namespaces:01 ocaml:01 frog:98 polymorphic:01 On Sunday 24 June 2007 19:51:02 Arnaud Spiwack wrote: > ...btw object coercion should never cost anything > since they are merely type level tools... Even in statically typed systems you might well want to shift work to run-time (e.g. specialization of all-float records/arrays) so I see no reason to expect coercion to be free. > At runtime, I can't see anything to preven objects to be exactly records > (with a bit of care taken during compilation for method names). How can the current representation of records handle virtual method dispatch? > John > Skaller's answer is not really convincing either, since the type of a > value does not change the size of the value, having the same name > associated to different types does not seem to me a good motivation. I think this choice makes OCaml's object system more orthogonal to the rest of the language. > Another lead is maybe something due to module compilation, the > earlier idea might imply that each module has it's own namespace (it's > the case for almost everything in OCaml, except, if I'm not mistaking, > method names and polymorphic variants. > If it is the motivation for having a runtime > representation of objects different to that of records, the question > that raises nex is: what is the motivation for not having > module-specific namespaces for method names? If I have two modules containing two classes and I want them to be related, how can you implement that with structurally-subtyped OO if method names are local to modules? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. The OCaml Journal http://www.ffconsultancy.com/products/ocaml_journal/?e