predef & clear bugs (relatively serious!) a=1 predef(1) clear a // i
Reported by Ricardo Fabbri
-- Bug description --
predef & clear bugs (relatively serious!)
a=1
predef(1)
clear a // it clears!!
a // don't exist!
a=1
predef('all');
clear a // doesn't clear
a // exists!
Why predef(n) predefine the max(n,7) variables? Why this
seven number??? Why not have a predef(n) where n is the
last n variables, be it 1 or 2 or 100??
This one can make scilab broken:
suppose I load a function using the "lib" command (a
toolbox, for example). Test this with the SIP toolbox:
After loading the toolbox, we have some Scilab functions
defined. SIP does NOT use any predef('all') in its load
code. If the user issues a simple "clear", then the SIP
functions coded in Scilab language will be unloaded, and
the user is left with a broken system.
For instance, when the toolbox is loaded, "imshow" will be
defined. Now lets do the following test:
clear imshow // does NOT clear
imshow // ok, exists
Now, try this:
function b=myfoo(a)
b = a + 1;
endfunction
clear foo // OK, it clears!
foo // not defined!
Now redefine the foo function above.
And try this:
clear
Now BOTH foo AND imshow will be erased. This is
inconsistent!!
For instance, why clear imshow doesn't clears
but clear (without args) does eliminate imshow???
-- Scilab error message --
"undefined variable", etc..
-- How to reproduce the bug --