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 "[<poly>;<poly>]":

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.

--
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to