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:43)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: status of some big "important" features?

On Sat, Dec 30, 2000 at 11:30:57AM -0800, Chris Hecker wrote:

> 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?

Camlp4 does not know what a type definition is: for it, it is just a
syntax thing. Therefore, in the line "print_member_camlp4 a", Camlp4
does not know what "a" is: for it, it is just "the identifier a",
that's all. The fact that it is a variable previously defined of type
"foo" is typing. If you want to treat that at Camlp4 time, you have to
write a types inference algorithm. A compiler...