[mercury-users] lisp macros
Peter Schachte
schachte at cs.mu.OZ.AU
Mon Jun 3 11:26:58 AEST 2002
On Thu, May 30, 2002 at 05:00:29PM +1000, Michael Day wrote:
> Wouldn't it be difficult for the compiler to parse a module that contained
> macros that acted on that module itself?
Parse, no, but sometimes it is difficult to write a module that
expands source code in such a way that it can successfully expand
itself. I often use a trick to ensure that my term_expansion clauses
are not applied to the module that defines them. In fact, if the
Prolog system removes the old definition of a predicate before
compiling the new one, then much of the time when compiling your
own term_expansion module, the expansion code in memory will be
incomplete.
> Would it be necessary to define
> macros in one module to use them in another? That way the macro module
> could be compiled and then executed by the compiler on the second
> module...
I think that is the most sensible solution to this problem. For a
system that supplies only a source-to-binary compiler, it will not be
possible to compile a file that defines expansion clauses that are
meant to be run on itself: you would need to have compiled the file
before you could compile the same file.
--
Peter Schachte That government is best which governs least.
schachte at cs.mu.OZ.AU -- Thomas Jefferson
www.cs.mu.oz.au/~schachte/
Phone: +61 3 8344 9166
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list