octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'clear java'


From: Rik
Subject: Re: 'clear java'
Date: Fri, 21 Dec 2012 11:45:45 -0800

On 12/21/2012 06:55 AM, Philip Nienhuis wrote:
> Straight quote from the documentation,
>>
>> "The functions javaaddpath and javaclasspath(dpath) add entries to the
>> dynamic class path. To avoid the possibility that the new path contains a
>> class or package with the same name as an existing class or package, MATLAB
>> clears all existing global variables and variables in the workspace."
>>
>> And from javaaddpath,
>> "MATLAB calls the clear java command whenever you change the dynamic path."
>>
>> So, it's possible that they don't mean what they say.  Or maybe the example
>> I gave was somehow too simple.  I guess we won't bother with compatibility
>> in this case.
>
> Matlab has the "import" command to import certain Java classes (from Java
> class libs in the javaclasspath).
> I never understood in detail how it works. But it may be that it is those
> imported classes that get reset.
>
> BTW (now that I see it) will a "clear java" command be implemented in
> Octave? (I mean is it needed?)
>
I'm not sure it is absolutely needed, but it does seem like a gap in
compatibility that should reasonably be closed.  And on a quick look, it
doesn't look like it would be that difficult to implement.  One could loop
over objects in the symbol table, call isjava() on them, and delete them or
not based on that test.  It does look like a fair amount of C++ boilerplate
code would be needed to accomplish that (nothing hard, but possibly
tedious) as there would be modifying Fclear and adding a do_clear_java
routine in variables.cc.  In symtab.h you would probably need a clear_java,
clear_java_pattern, do_clear_java_pattern, clear_java_regexp, and
do_clear_java_regexp routines.

I'll file an issue report on the bug tracker about this so it isn't forgotten.

--Rik





reply via email to

[Prev in Thread] Current Thread [Next in Thread]