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 84A5ABC57 for ; Mon, 1 Mar 2010 21:18:49 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhEBAIqvi0tRZ90vkWdsb2JhbACDBZgCFQEBAQEJCwoHEwMfiBulAY9DgTSBG4FCagSDMw X-IronPort-AV: E=Sophos;i="4.49,562,1262559600"; d="scan'208";a="53829565" Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]) by mail1-smtp-roc.national.inria.fr with ESMTP; 01 Mar 2010 21:18:49 +0100 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20100301201848.BPW4204.mtaout01-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Mon, 1 Mar 2010 20:18:48 +0000 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20100301201847.IDEM21638.aamtaout02-winn.ispmail.ntl.com@romulus.metastack.com>; Mon, 1 Mar 2010 20:18:47 +0000 Received: from Tenor ([212.183.140.54]) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id o21KIZYa021475 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 1 Mar 2010 20:18:39 GMT From: "David Allsopp" To: , "'David Allsopp'" Cc: "=?UTF-8?Q?'St=C3=A9phane_Glondu'?=" , "'OCaml List'" 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> <000d01cab93d$b095c770$11c15650$@romulus.metastack.com> <4B8BC220.8030904@citycable.ch> In-Reply-To: <4B8BC220.8030904@citycable.ch> Subject: RE: [Caml-list] Recursive subtyping issue Date: Mon, 1 Mar 2010 20:18:19 -0000 Message-ID: <004201cab97c$6138dc00$23aa9400$@romulus.metastack.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQG++dev6usjy+MhCCiCMQMXQZ/itALZ1N3bAhDBEaACMQ+SQQJi1d9iAtZavDECFUz3DwKgUGxPA1Sa9KMBLUbUWwG7IK8HAbcyleEBcyjtLgKp3OXs Content-Language: en-gb X-MSL-Actually-To: dra-news@metastack.com Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.1 cv=1ggfb5FlKZQUfF3vzm9UBYZ2uTfLsbs/8dSljwg5+mE= c=1 sm=0 a=wNs1GRMElQMA:10 a=ZOzjf2MOAAAA:8 a=lGqTAyGYteTblfkF608A:9 a=1beugDNDRK_fu7oXrgkA:7 a=zPA9VR4DKV8vqcYEULNRzb_1_a4A:4 a=H1paHlvfXV0A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Spam: no; 0.00; recursive:01 subtyping:01 guillaume:01 foo:01 foo:01 mli:01 ocamlopt:01 usr:01 lib:01 ocaml:01 mli:01 ocamldoc:01 coercions:01 ocamldoc:01 subtyping:01 Guillaume Yziquel wrote: > David Allsopp a =C3=A9crit : > > > > external foo_of_bar : bar -> foo =3D "%identity" > > > > in *both* the .ml and .mli file for the module in question. I'm > virtually certain that ocamlopt eliminates calls to the %identity > primitive. >=20 > yziquel@seldon:~$ grep magic /usr/lib/ocaml/obj.mli external magic : = 'a > -> 'b =3D "%identity" >=20 > So far so good. I don't follow...? > > This is tremendously clean - as long as the types are clearly > documented! The problem is that ocamldoc doesn't let you "document" > coercions (by which I mean that having a conversion function provides > means for the documentation of that particular usage). >=20 > Thank you. The ocamldoc problem isn't really a problem, I believe. You > just have to write it cleanly in bold letters. >=20 > What is more a problem is the fact that inferred .mli files tend to > leave out the contravariance on tau: >=20 > http://caml.inria.fr/mantis/view.php?id=3D4988 >=20 > And hence drops part of the subtyping facility. Though that's another good reason for never, ever, ever, ever using = inferred .mli files - the signature is part of your code! ocamlc -i is = useful only for generating the first cut of the file so that you can = double-check (and probably constrain) the inferred type annotations and = add ocamldoc comments... David