Re: [eclipse-clp-users] Differences in behaviour between 5.1 and 6.0

From: Joachim Schimpf <jschimpf_at_...153...>
Date: Fri, 26 Dec 2008 23:06:49 +1100
  luke2k4_at_...6... wrote:
> Hey there,
> I've just subscribed to this list so I wanted to say hi to everyone.
> I wanted to ask about the new 6.0 compiler and the TkEclipse  that comes 
> with it.
> Today I've been testing one of my eclipse projects with the new tools 
> and, and unfortunately it does not run on 6.0 as it did on 5.1 , here 
> are the reasons:
> 
> 1. There is some issue with the conditionals, In my code I used 
> conditionals of the form:
>         (DurDomVal=DurMin..DurMax->
>             true
>         ;
>             DurDomVal = DurMin,
>             DurDomVal = DurMax
>         ),
> this worked fine with the 5.10 but now it doesn't because DurMin and 
> DurMax are singletons for the new compiler. This means that the 
> condition in the first line is not global in scope.

You get extra warnings from 6.0, but there is no difference in the
semantics, i.e. the behaviour of the code is the same as in 5.10.

If DurMin and DurMax do not occur anywhere _outside_ the conditional,
then they really are singletons (as the compiler reports), and your
whole code fragment is equivalent to 'true'.

My suspicion is that there may be some problem in the context of this
fragment, maybe related to a do-loop?  Can you show us the complete clause?


 > There is an obvious
> workaround :
> 
>         (DurDomVal=_DurMin.._DurMax->
>             true
>         ;
>             DurDomVal=DurMin..DurMax,
>             DurDomVal = DurMin,
>             DurDomVal = DurMax
>         ),
> 
> but it is less compact and not logical for me. This is a small thing but 
> maybe someone can justify why it works in this new way.

I'm not sure what you mean to achieve here - this does something
different from your previous code.


> 
> 2. As far as I have noticed the "Observe this term" and "Observe this 
> goal" functionality does not work. It's probably because  the Display 
> Matrix is not working, the predicate "make_display_matrix(AA,aa)" 
> returns true but nothing happens. It has not been implemented yet in 
> this version of tools? Or is this an isolated problem only in my 
> environment ?

I have checked, but it works for me.  Please send a more detailed
bug report to eclipse-clp-bugs_at_lists.sourceforge.net, or put it directly
into the bugzilla database, see http://eclipse-clp.org/bugs.html


> 
> 3.I had some problems with constructing arrays of lists.
> The code below for the 5.1 compiler resulted in creating a term 
> containing an open list in Term2 and Term1 was a term containing the 
> list's tail. With 6.0 something strange happens, both Term1 and Term2 
> contain the NewTail variable
> 
>     functor(Term1,functor1,1),
>     functor(Term2,functor2,1),
>     (foreacharg(Term1Var,Term1,Idx),
>      param(Term2) do
>         setarg(Idx,Term2,Term1Var)
>     ),
>    
>         arg(1,Term1,Tail),
>         Tail = [smething,NewTail],
>         setarg(1,Term1,NewTail)

This use of setarg/3 is one of the ambiguous cases that the manual
warns about, and that's why setarg/3 should generally be avoided.
On the other hand, the problem of efficiently maintaining arrays
of (difference) lists probably cannot be solved without it...

To fix your code, replace the foreacharg loop above with:

    (for(Idx,1,arity(Term1)), param(Term2,Term1) do
         setarg(Idx,Term1,Term1Var),
         setarg(Idx,Term2,Term1Var)
    ),

This works because now even the initial value of the argument of Term1
gets set via a setarg (and not via an implicit arg/3 as before).

It would be nice if you could contribute a library implementing
arrays of lists, so these setarg-tricks are nicely encapsulated.

You could also have a look at lib(notify_ports), which implements
something quite similar and may be what you need.


> 
> I would be grateful if someone could comment on the 3 points, are they 
> bugs ?
> I'm using  the tools in version 6.0 #58 i386_nt
> 
> Best Regards
> Łukasz Domagała


Season's greetings to everyone!

-- Joachim
Received on Fri Dec 26 2008 - 12:06:59 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST