Re: [eclipse-clp-users] Variable Names

From: Kish Shen <kisshen_at_cisco.com>
Date: Fri, 05 Feb 2010 16:44:59 +0000
Christian Wirth wrote:
> Hi,
> 
> i'm using eclipse clp in connection with java. My problem is, that when 
> i get the resonse to a rpc call, i don't get the variable names.
> 
> Example:
> 
> When the value is mark(_235,_236) in eclipse it gets returned to java as 
> mark,null,null but i need to preserve this information.
> 
> How to ?
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users

It is a deliberate design decision to limit the ECLiPSe terms you can 
represent in Java. In particular, all variables are unique in Java, so
something like a(X,X) cannot be represented in Java using the interface.
The only real use of variables are as place holders, i.e. when you issue 
an RPC to ECLiPSe, for any answers to be returned by instantiating these 
variables.

The idea is that you should not try to write complex ECLiPSe code using 
Java/RPC -- you should write these in ECLiPSe, and the RPC is a simple 
goal to start the execution of the ECLiPSe code, and return any simple 
results. If you want to know more about the reasoning behind the design, 
please look at the paper:

A High-Level Generic Interface to External Programming Languages for ECLiPSe
     by Shen K and Schimpf J and Novello S and Singer J.,
Proceedings of Practical Aspects of Declarative Languages,
4th International Symposium, PADL 2002, Lecture Notes in Computer 
Science 2257, pg 262-279, © Springer-Verlag, January 2002.

which you can download from
http://www.eclipse-clp.org/reports/eclipse_generic_interface.ps.gz

In any case, as Wit asked, why do you want the variable names? Even in 
ECLiPSe itself, when a query is returned like your example,

  mark(_235,_236)

you cannot then use _235 to refer to the same variable in your next 
query. [they are in different queries, and in any case, _235 is a name 
generated by the system, designed only to be different from other 
generated names (at that time), but not from variable names defined by 
the user. SO it is possible for the "same" name to represent different 
variables. For example, on my tkeclipse,

the query write([_])

prints [_71]

and the query write([_,_71])

prints [_71,_71]

even though the two variables are not the same -- the first _71 is 
generated by the system, the second _71 is a name I gave the second 
variable, but the two variables are different.

Cheers,

Kish




-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Fri Feb 05 2010 - 16:45:28 CET

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