From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id pB890kNb013353 for ; Thu, 8 Dec 2011 10:00:46 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah8BAEx84E7B/BfSkWdsb2JhbABDhDZQpgABAQEBCQsLBxQDIoFyAQEFDBcECwEFQAEQCQIOCgICBRYLAgIJAwIBAgFFBg0BBwEBiAUGpUiROIE0iHGBFgSUa4VLjFw X-IronPort-AV: E=Sophos;i="4.71,319,1320620400"; d="scan'208";a="122544547" Received: from msa01.smtpout.orange.fr (HELO msa.smtpout.orange.fr) ([193.252.23.210]) by mail4-smtp-sop.national.inria.fr with ESMTP; 08 Dec 2011 10:00:40 +0100 Received: from [192.168.1.102] ([83.199.18.102]) by mwinf5d03 with ME id 6Z0f1i00b2C8GJT03Z0fT0; Thu, 08 Dec 2011 10:00:40 +0100 Message-ID: <4EE07CB7.6090106@frisch.fr> Date: Thu, 08 Dec 2011 10:00:39 +0100 From: Alain Frisch User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Edgar Friendly CC: caml-list@inria.fr References: <1323271707.32238.17.camel@arrakis> <4EE02213.70200@gmail.com> In-Reply-To: <4EE02213.70200@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] Generic printer patch On 12/08/2011 03:33 AM, Edgar Friendly wrote: > On 12/07/2011 10:28 AM, Jérémie Dimino wrote: >> Hi, >> >> I have made a patch for ocaml 3.12.1 which allow to have a generic >> printing function. The patch is available here: >> >> external show : 'a -> string = "%show" >> >> Of course it is limited to what the compiler knows, for example the >> following function will always returns "[;]": > > I'm interested in having compile-time reflection like this, but maybe > with a bit more generality. You might be interested in my proposal to extend OCaml with a notion of runtime representation of types: http://www.lexifi.com/blog/runtime-types A generic value pretty-printer can be written in "user-land" using this extension (in a type-safe way). -- Alain