This is a good question, and not one that has been asked before. In
all released versions of Jess, redefining a function works
inconsistently. In particular, if a rule calls a deffunction defined
before the rule is defined, then if the deffunction is redefined, the
rule will still call the old version, while the new version will be
available from the command line. This sounds horrible, but in practice
it's really not; no-one has ever mentioned it to me before!
The situation is worse for Userfunctions written in Java. A running
JVM doesn't particularly like to redefine classes while it is
running. To do so, you need to use a new ClassLoader for each instance
of the reloaded class, or you need to allow the old definition to be
class-garbage-collected, a behaviour which has been hotly debated and
has resulted in some revisions to the Java Language Specification as
of late.
The next release of Jess 5.0ax will fix the first problem, but won't
address the second problem. Creating a separate ClassLoader for all of
the 250+ functions typically loaded into Jess would be a heavy
resource drain. I suppose I could write a custom non-caching
classloader for Userfunctions, but then there would be a rain of
questions about security violations - ClassLoaders can't be used in
applets, or RMI servers, etc. I suppose I could work around that too ...
Is this a problem that bothers other people too?
I think S Yang wrote:
>
> Dear All,
>
> I am new to this list and quite new in JESS programming.
> Please be patient if my question is too simple or has been
> asked bofore.
>
> I am writting a JESS program which needs to call several
> JAVA functions. I use (load-function xxxx) to start the
> JAVA function. All goes well except that if I modify the
> JAVA function, the modification does not take effect until
> I quit from JESS and start again. It is a bit tedious as
> it is generally the case that I need to do many changes
> and tests before the function would do exactly what I want.
> Is there a way to overide the previous definition of a
> function? I tried (clear), (reset), and (load-function xxxx).
>
> Thanks in advance.
>
> Sam Yang
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
>
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9214 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------