Doesn't this piece code of solve changing of the unwanted "global
variables"?

public void setVariable(String name, Value value) throws JessException
{
        Hashtable ht;
        if (m_rete.findDefglobal(name)!=null)
            ht = findVariable(name);
        else
            ht = getVariables();
        ht.put(name, value);
}

> global scope is special. If a variable doesn't exist in a local scope,
> then the global scope is searched.
That's how I expect it too.

> In Jess, if the variable doesn't exist in either the local or the global
> scope, then it's created in the local scope. This isn't terribly surprising.
I complained that variables defined in the global scope (and it's
not a global variable) can be changed by functions.

As you mentioned the main difference between jess and f.i. C is that the
variables in jess can't be declared, but it also means that they can't be
redeclared in the local context, that's why all variables are somehow
global. If I write (or take from a different jess code) a deffunction,
which uses "by mistake" a variable with the same name, then it can change
something exept of returning a value, which should be the only task of
the functions (hmm.. I should think it over, maybe with some exceptions
it's true).
    Well, I don't consider it as a bit problem, as usually variables are
not declared in the global context, so probably this feature of jess
doesn't harm too much.

        f.gy.



--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to