Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-17 Thread Waldek Hebisch
oldk1331 wrote:
> 
> I find a method to counteract the effect of 'clearConstructorCache':
> 
> Building expressions using ==, after compiling a file, switch the
> definition of independent variable, causing expressions to be rebuilt:
> 
> x == x1
> t == sqrt (2* sqrt(x^4))
> # tower sqrt(t^3)
> )co manip
> x == x2  -- switch definition
> # tower sqrt(t^3)

Yes, this seem to work.  AFAICS you can do:

x == 'x

to avoid introducing new name.  And repeating this definition
should be enough: interpteter notices that there is new definiton
even if right hand side is the same.

-- 
  Waldek Hebisch

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread oldk1331
I find a method to counteract the effect of 'clearConstructorCache':

Building expressions using ==, after compiling a file, switch the
definition of independent variable, causing expressions to be rebuilt:

x == x1
t == sqrt (2* sqrt(x^4))
# tower sqrt(t^3)
)co manip
x == x2  -- switch definition
# tower sqrt(t^3)

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread Waldek Hebisch
oldk1331 wrote:
> 
> On Thu, Feb 16, 2017 at 11:14 PM, Waldek Hebisch
>  wrote:
> >>
> >> Can you point out where does "invalidates
> >> all kernel caches" happen?
> >> (So that I can disable it when I'm sure it's safe.)
> >
> > Directly this is done by 'clearConstructorCache'.  Without
> > 'clearConstructorCache' if you load new version of constructor
> > you will get strange mix of old and new routines.  So
> > during developement skipping 'clearConstructorCache' is
> > essentially never safe.
> 
> If I compile a spad file that only contains packages (so no new
> version of domain constructor), will that be safe to skip
> 'clearConstructorCache'?

No.  Without 'clearConstructorCache' all domains/packages
will continue to use old version of compiled package.
So basicaly the only safe case is if anything that used
previous version will be no longer used.  In particular
if package was unused before (in this case call to
'clearConstructorCache' is automaticaly skipped).
In normal testing scenario when you try the package,
recompile and try again the only safe variant is
when the package is only used directly from command
line but not from other domains/packages.

-- 
  Waldek Hebisch

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread oldk1331
On Thu, Feb 16, 2017 at 11:14 PM, Waldek Hebisch
 wrote:
>>
>> Can you point out where does "invalidates
>> all kernel caches" happen?
>> (So that I can disable it when I'm sure it's safe.)
>
> Directly this is done by 'clearConstructorCache'.  Without
> 'clearConstructorCache' if you load new version of constructor
> you will get strange mix of old and new routines.  So
> during developement skipping 'clearConstructorCache' is
> essentially never safe.

If I compile a spad file that only contains packages (so no new
version of domain constructor), will that be safe to skip
'clearConstructorCache'?

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread Waldek Hebisch
oldk1331 wrote:
> 
> > so ')compile'
> > invalidates them all.  Smarter ')compile' could
> > track dependencies and try to invalidate only
> > minimal set of constructors, but this is tricky
> > to implements.
> 
> Can you point out where does "invalidates
> all kernel caches" happen?
> (So that I can disable it when I'm sure it's safe.)

Directly this is done by 'clearConstructorCache'.  Without
'clearConstructorCache' if you load new version of constructor
you will get strange mix of old and new routines.  So
during developement skipping 'clearConstructorCache' is
essentially never safe.

> BTW, does this affect your development loop?
> I mean, after compiling a file, you have to
> re-eval all variables?

Well, expressions.  For short seqences of commands I recall
them from command history.  Longer ones I put in files.


-- 
  Waldek Hebisch

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread oldk1331
> so ')compile'
> invalidates them all.  Smarter ')compile' could
> track dependencies and try to invalidate only
> minimal set of constructors, but this is tricky
> to implements.

Can you point out where does "invalidates
all kernel caches" happen?
(So that I can disable it when I'm sure it's safe.)

BTW, does this affect your development loop?
I mean, after compiling a file, you have to
re-eval all variables?

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread Waldek Hebisch
> 
> (1) -> t := sqrt (2* sqrt(a^4));
> 
> (2) -> # tower sqrt(t*t*t)
> 
>(2)  4
> 
> (3) -> )compile manip.spad
> -- or compile any other spad file
> 
> (3) -> # tower sqrt(t*t*t)
> 
>(3)  3
> 
> 
> I use '#' to make output shorter.  As you can see, after
> compiling a file, the output of "tower" changes!
> 
> This is pretty serious. Is this a known behaviour?

Yes.  ')compile' replaces old kernel cache by new one
(it has to because after compile potentially all
constructors are invalid).  In effect all kernels
stored in variables are invalid.  Arguably ')compile'
should clear all interpreter variables.  I guess that
original authors decided that most variables remain
valid and users using ')compile' can recompute ones
which became invalid.  OTOH user normally have no
way to invalidate cached constructors (beside recompiling
the conctructor, but this is time consuming and
require knowledge of dependencies), so ')compile'
invalidates them all.  Smarter ')compile' could
track dependencies and try to invalidate only
minimal set of constructors, but this is tricky
to implements.

-- 
  Waldek Hebisch

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


[fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread oldk1331
(1) -> t := sqrt (2* sqrt(a^4));

(2) -> # tower sqrt(t*t*t)

   (2)  4

(3) -> )compile manip.spad
-- or compile any other spad file

(3) -> # tower sqrt(t*t*t)

   (3)  3


I use '#' to make output shorter.  As you can see, after
compiling a file, the output of "tower" changes!

This is pretty serious. Is this a known behaviour?

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.