[Scilab-Dev] jimport error on calling environment: blocking scope issue

Samuel Gougeon sgougeon at free.fr
Sun Jul 21 22:27:52 CEST 2019


Hello,

I am facing some very  serious issue. It is so trivial and surprising 
that i am wondering if this blocking behavior is intentional, and if yes 
why and how to by-pass it if possible:

--> clear File, clearglobal File
--> function test(), jimport java.io.File, disp(File), endfunction
--> test() // OK
class java.io.File
--> File
Undefined variable: File // So the File class is local. It is not 
returned to the caller, from the Scilab point of view.
--> File = 1;
--> test()
at line     1 of function test
jimport: An error occurred: A variable with this name is already existing
!!!!

So jimport refuses to create a local Scilab mlist (class) on the reason 
that there is a Scilab variable with the same name in the */calling/* 
environment !

Since it's impossible to ensure that no /File/ variable is defined by 
some process in the (nested) callers up to the console level,/*jimport 
is definitely fragile*/.

Is this a bug, and is there any work-around?

Thanks
Samuel


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20190721/a98e2085/attachment.htm>


More information about the dev mailing list