>
> > > The most problematic issue for me right now is that using ")compile 
> > > file.spad" multiple times 
> > > without ")clear all" in-between will completely break things. For 
> example 
> > > something like: 
> > > 
> > > )co mypackage 
> > > test := sqrt(x) 
> > > subst(test, x=0) 
> > > 
> > > gives sqrt(0) as it should, but once I use )co mypackage again 
> > > it no longer substitutes x=0 and just returns sqrt(x). This then 
> > > completely breaks the functionality in the package. 
> > > A fix for this is to use ")clear all" in between, or to redefine test. 
> Is 
> > > this "intended" or known behavior? I've had 
> > > similar issues before where ")clear completely" was necessary. 
>
> The issue was known, it has almost nothing to do with Spad compiler, 
> in particular the same should happen when using Aldor from FriCAS. 
> The core problem is that kernels are supposed to be unique. 
> Compilation has to invalidate existing domains, to make sure 
> that new code is used in all places. Kernels are stored in 
> separate domain called 'SortedCache', invalidating this domain 
> led to duplicate kernels and chaos. More precisely, there is 
> support for (at least somewhat) safely invalidating old kernels, 
> but it was not used. AFAICS attached patch solves your problem.
>

Your patch indeed fixed that example. But I came across a related issue, so 
it doesn't seem to be completely fixed.
I was able to produce a somewhat minimal bug example that can be enabled 
when recompiling a package.

I also came across an issue like that just when re-loading a matrix from a 
Library file, but I wasn't able to nail
it down to a minimal example yet. Hopefully it's the same underlying issue.

When enablebug is true, then the subtitution no longer works after 
recompiling any module. Strangely,
when enablebug is false, so I don't get tower for the matrix anymore, the 
issue doesn't appear.

----- SNIP -----
)clear completely

EI ==> Expression(Integer)

enablebug : Boolean := true
    
matrixKernels(x) ==
    removeDuplicates(reduce(append, map(tower, listOfLists(x))))


)co ptest.spad

if enablebug then
    mymat : Matrix(Expression(Integer))
    mymat := [[sqrt('x1)]]
    eval(matrixKernels(mymat)(1) :: EI, ['x1=4]) -- this is a crucial 
statement to cause the bug

myexpr : Expression(Integer)
myexpr := sqrt('x1)

eval(tower(myexpr)(1) :: EI, ['x1=4])

)co ptest.spad

if enablebug then
    eval(matrixKernels(mymat)(1) :: EI, ['x1=4])

eval(tower(myexpr)(1) :: EI, ['x1=4])

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/4cb5bbbb-8143-4a41-b294-8fe70bcd3e06n%40googlegroups.com.

Reply via email to