[mercury-users] lisp macros

Manuel Hermenegildo herme at clip.dia.fi.upm.es
Fri May 24 08:36:08 AEST 2002


 > Think of it this way:  if you weren't working here, you could never
 > have implemented the state thread transformation, or the new @ syntax
 > for naming terms or the ^ accessor facility, or ....  In terms of
 > language elegance, I would argue that rather than being part of the
 > Mercury language, these features should live in libraries and be
 > defined as some kind of source to source translation.

I think Peter is very right. Extensibility is a very useful thing.

 > FWIW, Prolog's term expansion facility is much more powerful than
 > Lisp's macros, especially if the Prolog implementation tolerates
 > transforming a clause into a list of clauses, and if it expands
 > end_of_file.  It's not elegant, but it is powerful.  All of the
 > Mercury features I named would be fairly easy to implement in Prolog
 > using term expansion.

And, you can design improved versions of term_expansion that are more
flexible and easier to use, and which allow you to define syntax
extensions on a per-module basis (this is the way in which Ciao Prolog
implements functions, constraints, records, etc., etc.). This
reference has some useful ideas in this respect:

@InProceedings{ciao-modules-cl2000,
  author =       {D.~Cabeza and M.~Hermenegildo},
  title =        {{A} {N}ew {M}odule {S}ystem for {P}rolog}, 
  booktitle =	 {International Conference on Computational Logic, CL2000},
  publisher =    {Springer-Verlag},
  series =       {LNAI},
  number =       {1861},
  year = 	 2000,
  month = 	 {July},
  pages=         {131--148}
}

Cheers,

Manuel


-- 

-----------------------------------------------------------------------------
herme at fi.upm.es                      | Manuel Hermenegildo                 
+34-91-336-7435 (Work)               | Facultad de Informatica, UPM
+34-91-352-4819 or 336-7412 (FAX)    | Universidad Politecnica de Madrid   
http://www.clip.dia.fi.upm.es/~herme | 28660-Boadilla del Monte, MADRID SPAIN
-----------------------------------------------------------------------------

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