English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
status of some big "important" features?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-12-30 (21:42)
From: Chris Hecker <checker@d...>
Subject: Re: status of some big "important" features?

>> PS.  Minor question I thought of the other day...is there any way to
>> write "nth" for tuples (as opposed to "fst", which is hard-coded to
>> 2-tuples)?
>Impossible in Camlp4, it is a typing problem.

Oh, I thought camlp4 had the types available to it.  I must have misunderstood the docs.

Hmm.  So similarly, you couldn't write an introspection thing like this in camlp4:

type foo = {bar:float; baz:int };;
let a = {bar = 1.;baz = 1};;
print_members_camlp4 a;;

Where print_members_camlp4 is hooked by camlp4 to iterate over the members of whatever record was passed to it (or error at compile time if it's not a record)?  That's not possible?

Chris