Hi David,

Well, they're pretty similar; they used to be represented by two Java
classes related by inheritance, but now there's only one class for
both. Contexts work like nested scopes. Each context has a parent
context (except for the global one.) If you ask for a variable binding
in a Context, the 'closest' binding is returned, so bindings in "more
local" Contexts hide those in "more global" ones.

OK, so to answer your question more specifically: a Userfunction is
passed a context that will contain definitions of all the variables
that might be included as parts of its arguments. This may or may not
actually be the global context, or a more local one. That Userfunction
should pass the context it receives on to all other Userfunctions or
Value methods that need one.

If you're writing Java code not invoked by Jess, then only Jess global
variables might be referred to; hence engine.getGlobalContext() will
do it. 


I think David E. Young wrote:
> 
> Hello. I'm curious as to the semantic and behavioral differences
> between "local" and "global" contexts (i.e. the Context argument given
> to UserFunctions vs. Rete.getGlobalContext()). In particular, which
> one should I choose when invoking Funcall.execute()? There isn't a
> clear distinction in the documentation, and I'm trying to avoid
> porting woes. Thanks.
> 
> Regards,
> 
> -- 
> -----------------------------------------------------------------
> David E. Young
> Fujitsu Network Communications  "The fact that ... we still
> ([EMAIL PROTECTED])    live well cannot ease the pain of
>                                  feeling that we no longer live nobly."
>                                   -- John Updike
> "Programming should be fun,
>  programs should be beautiful"
>   -- P. Graham
> ---------------------------------------------------------------------
> 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]
---------------------------------------------------------------------

Reply via email to