From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id pB82Y5XS024941 for ; Thu, 8 Dec 2011 03:34:05 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmABACEh4E7RVdW2kGdsb2JhbABDhDZQpUsIIgEBAQEJCQ0HFAQhgXIBAQEEDAYCDwQLAQUIARseAwwGAwILDQICBSECAg8CEhEBBQEcEwgBAR6hWAqLHEiCa4RSPYhxAgUMgSiGaIICgRYEiC6MPYVKgTSGcT2EFQ X-IronPort-AV: E=Sophos;i="4.71,317,1320620400"; d="scan'208";a="134456279" Received: from mail-yx0-f182.google.com ([209.85.213.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 08 Dec 2011 03:33:59 +0100 Received: by yenl9 with SMTP id l9so1349942yen.27 for ; Wed, 07 Dec 2011 18:33:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=K2DRFXBpNvUl9FUYouNFdKxLBa5zgFFzR0AnULYfBVE=; b=bFIKGeFZmNaQ4aoZVRcCxqCOZclW9hxV9z6sIiEDCFSQd960ZHr0vKFFA2hiKWCiYm GU0cnAJIkYEgZI1qaIxifE8gdKSOeQR316KYCRbLtMeFew6x4bgc+eKJYY+88tqz3IMs 84RLD8K2o+I88z8YikdAHD1IH+ueXhGLHQ1zg= Received: by 10.236.189.6 with SMTP id b6mr1286264yhn.72.1323311638293; Wed, 07 Dec 2011 18:33:58 -0800 (PST) Received: from [192.168.1.65] (99-121-78-10.lightspeed.lnngmi.sbcglobal.net. [99.121.78.10]) by mx.google.com with ESMTPS id t3sm10424915anf.0.2011.12.07.18.33.56 (version=SSLv3 cipher=OTHER); Wed, 07 Dec 2011 18:33:57 -0800 (PST) Message-ID: <4EE02213.70200@gmail.com> Date: Wed, 07 Dec 2011 21:33:55 -0500 From: Edgar Friendly User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 MIME-Version: 1.0 To: caml-list@inria.fr References: <1323271707.32238.17.camel@arrakis> In-Reply-To: <1323271707.32238.17.camel@arrakis> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] Generic printer patch 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. Maybe an identifier can be built out of the type in a generic way... external show : 'a -> string = "%type_to_string" external print : out_channel -> 'a -> unit external cmp : 'a -> 'a -> int = "%type_compare" etc. E.