From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id A87387F2B5 for ; Mon, 24 Dec 2012 00:59:39 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of tiphaine.turpin@free.fr) identity=pra; client-ip=212.27.42.5; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="tiphaine.turpin@free.fr"; x-sender="tiphaine.turpin@free.fr"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of tiphaine.turpin@free.fr) identity=mailfrom; client-ip=212.27.42.5; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="tiphaine.turpin@free.fr"; x-sender="tiphaine.turpin@free.fr"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp5-g21.free.fr) identity=helo; client-ip=212.27.42.5; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="tiphaine.turpin@free.fr"; x-sender="postmaster@smtp5-g21.free.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag4BABea11DUGyoFlGdsb2JhbABEhjqzQAqDcxYOAQEBAQkLCQkUAySCHgEBBAEjVgUWGgINBBUCIzYGE4gAAQMGAwoIonCHRQlBDAGJVYEiiktqG3OCIoETA5Q2gnKKG4gGgWw1 X-IronPort-AV: E=Sophos;i="4.84,343,1355094000"; d="scan'208";a="166687283" Received: from smtp5-g21.free.fr ([212.27.42.5]) by mail4-smtp-sop.national.inria.fr with ESMTP; 24 Dec 2012 00:59:38 +0100 Received: from spooler8-g27.priv.proxad.net (unknown [172.20.243.233]) by smtp5-g21.free.fr (Postfix) with ESMTP id 8CFADD48042; Mon, 24 Dec 2012 00:59:34 +0100 (CET) Date: Mon, 24 Dec 2012 00:59:33 +0100 (CET) From: tiphaine.turpin@free.fr To: Adrien Cc: caml-list@inria.fr Message-ID: <545877931.101048917.1356307173266.JavaMail.root@spooler8-g27.priv.proxad.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [88.167.129.69] X-Mailer: Zimbra 7.2.0-GA2598 (ZimbraWebClient - FF3.0 (Win)/7.2.0-GA2598) X-Authenticated-User: tiphaine.turpin@free.fr Subject: Re: [Caml-list] [ANN] RTT (Run-time types) online toplevel for trying ----- Mail original ----- > De: "Adrien" > =C3=80: "Tiphaine Turpin" > Cc: caml-list@inria.fr > Envoy=C3=A9: Dimanche 23 D=C3=A9cembre 2012 18:15:53 > Objet: Re: [Caml-list] [ANN] RTT (Run-time types) online toplevel for try= ing [...] > I've started playing with RTT through the Try RTT page (great idea > btw) and I'm not sure how to handle the following type: > type 'a t =3D { > t : 'a; > } Not sure what you are asking, but here a value representation of the type c= onstructor t is defined together with it (with name _type_t), as you can se= e in the toplevel. For basic usage, you don't need to use this value direct= ly, but it is involved when you manipulate a (value of) type u t for some t= ype u. For example, if you evaluate {t =3D ()} or {t =3D [1; 2]}, then _typ= e_t will appear in the dynamic type of thoses values. More precisely, if yo= u evaluate Rtt.typeof {t =3D ()}, the result will be the type Tconstr (_typ= e_t, [_type_unit]). > Also, it would be nice to see Rtt_type a bit more documented (the > purpose of some elements in rttype is unclear). Also, examples with a > few types would be very valuable. I admit that this is not much documented (partly because the actual represe= ntation of types does not matter for the most basic usage). >=20 > Apart from these two remarks, I'm happy with it so far and very > interested. The web toplevel is quite slow but I guess camlp4 is > pretty slow in javascript. There is not Camlp4 involved. Rtt acts as a pre-processor (when used for co= mpiling) but it uses the OCaml parser (and type-checker). As for this ineff= iciency, I haven't looked at its cause yet. > Btw, are you aware of http://lexifi.com/blog/runtime-types ? It > should > provide support for runtime types too without camlp4. I don't know > how > likely or close it is to being integrated into ocaml. Yes. My prototype addresses the same question as the work presented by Alai= n Frisch, but I consider the two things largely orthogonal, here is why: The extended compiler made by Lexifi uses a "typed" GADT-based representati= on of types to ensure a sound manipulation of run-time types. This represen= tation is much more elaborate than mine, also account for type abstraction,= and it has been applied in real world for several purposes, like safe unma= rshalling, GUI, and databases (quoting the blog post you mention). However,= as far as I understand, the type which is made available (using the additi= onal syntax "(type of expr)") is, at first, the static type (which is less = acurate when polymorphism is involved). I understand that, by adding type a= rguments to polymorphic functions, this limitation can be lifted, and that = part of these additional arguments can be inferred by the modified compiler= . The reason for my proposal is to go further in this way, providing (mostl= y) "exact" dynamic types, in a fully automated way (type representation arg= uments are added systematically by a program transformation). This is howev= er not simple for the full language, and the proof of concept that I propos= ed does not solve all aspects. Thank you for your feedback. Best regards, Tiphaine