Version française
Home     About     Download     Resources     Contact us    
Browse thread
A macro system compatible with modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Loup Vaillant <loup.vaillant@g...>
Subject: A macro system compatible with modules
Hello,

I would like to define a macro system (like #define) which satisfy the
following constraints :

-> When I define a macro, it is available for use right now, in the
same compilation unit.
-> If I want to call the macro from another compilation unit, I just
have to either open the corresponding module :

open My_comp_unit;;
(* some code *)
my_macro (* macro arguments *)

or access the macro through indirection :

My_comp_unit.my_macro (* macro arguments *)

-> [optional] a macro must declared in the .mli file to be accessible
from the outside, and is automatically accessible if this .mli file is
not defined by the author of the compilation unit.
-> [optional] do the same things for any module (defined as is, or
from a functor)

This would be ideal for avoiding namespaces issues.

What about plain camlp4 macros?
What about the #define defined in camlp4?
Is such a a thing possible?
To what extent?

Thanks,
Loup Vaillant

(reminder
  my ultimate goal is Lisp-like macros)