Version française
Home     About     Download     Resources     Contact us    
Browse thread
Question on camlp4 3.10
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] Question on camlp4 3.10
Excerpts from Benedikt Grundmann's message of Thu Jul 26 15:57:29 +0200 2007:
> Thanks,
> 
> But that gives me only the first part of my example.  What about the
> second one?  Is there an easy way to do that?
> 

Ah,  sorry  I didn't read the second part. It's a lot harder to have it correct
unless  you  completely ignore "open". You should do that with a Camlp4 filter,
that  store  the  module  path while traversing module declaration in a topdown
way.

> 
> 2007/7/26, Nicolas Pouillard <nicolas.pouillard@gmail.com>:
> > Look at the Camlp4MacroParser extension, there is __FILE__.
> >
> > Excerpts from Benedikt Grundmann's message of Thu Jul 26 15:46:26 +0200 2007:
> > > How can I get the name of the module where my syntax extension is
> > > applied?  For simplicity assume that I would like to write a MODULE
> > > macro similar to __FILE__ in c.
> > >
> > > shell> cat > test.ml
> > > let _ = print_endline MODULE
> > >
> > > shell> ./test
> > > Test
> > > shell> cat > test2.ml
> > > module M =
> > > struct
> > >   let _ = print_endline MODULE
> > > end
> > >
> > > shell> ./test2
> > > Test.M
> > >
> > >
> > > Cheers,
> > >
> > > Bene
> > >
> >
> > --
> > Nicolas Pouillard aka Ertai
> >
> 

-- 
Nicolas Pouillard aka Ertai