jimport error on calling environment: blocking scope issue

classic Classic list List threaded Threaded
2 messages Options
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

jimport error on calling environment: blocking scope issue

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



_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: jimport error on calling environment: blocking scope issue

Le 21/07/2019 à 22:27, Samuel Gougeon a écrit :

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 


This is now reported as the blocking bug 16165.



_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev