Re: [eclipse-users] macro and term_expansion

From: Joachim Schimpf (Independent Contractor) <jschimpf_at_cisco.com>
Date: Tue, 04 Sep 2007 10:20:24 +0100
klint09_at_libero.it wrote:
> Hi kish,
> my eclipse version is 5.10 su winXP (doseclipse).
> Excuse my errors and lapse.
> The problem:
> 
> 
>> Here is what I get:
>> [eclipse 1]: [user].
>> tra(a(a,A),b(b,A)).
>> :- local macro(a/2,tra/2,[term]).
>> user compiled traceable 132 bytes in 0.00 seconds
>>
>> Yes (0.00s cpu)
>> [eclipse 2]: [user].
>> a(a,1).
>> user compiled traceable 40 bytes in 0.00 seconds
>>
>> Yes (0.00s cpu)
>> [eclipse 3]: b(b,1).
>>
>> Yes (0.00s cpu)
> [eclipse 4]:  a(a,1).
> 
> yes.
> There is a(a,1).Why ?

No, there isn't an a(a,1).  You forget that when you declare a 'term' macro,
transformation happens in every context, so everytime you type a(a,1) it is
as if you had typed b(b,1) instead.

If you want to restrict transformation only to clauses for a/2, you must
give the 'clause' option to the macro declaration.

A more general remark: I don't know exectly what you want to achieve, but
many things that would require term_expansion in other Prologs can be solved
more conveniently in ECLiPSe using goal inlining (see inline/2).


-- Joachim
Received on Tue Sep 04 2007 - 10:20:31 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET