Hi David,
This one is in Jess. Line 253, Defrule.java: new Value() -> new
Variable().
I'm sorry you're having to find all these yourself. This is a classic
software design blunder: I'm generally careful about designing things
so that mistakes will get caught at compile time, but here's an
instance where I've designed something that throws an exception when
I've made a mistake. I could change things about so that Value
objects only came from a Value factory. This wouldn't lead to any
performance penalty, and might even be a bit more efficient since
fewer check would need to be done. Maybe that's what I should do.
Again, note that aValue.resolveValue(context).stringValue(context) and
aValue.stringValue(context) will both always return exactly the same
thing; the latter is more correct.
I think David E. Young wrote:
>
> OK folks. Another Value resolution problem, but this time I can't tell
> whether it's our stuff or Jess.
>
> Our system actually runs for awhile, so we're making progress. Here's
> the exception:
>
> Jess reported an error in routine Value.Value while executing (batch ./pvc/ces.c
> lp).
> Message: Cannot use jess.Value to represent variable _4_pname. You must use cl
> ass jess.Variable.
> Program text: ( batch ./pvc/ces.clp ) at line 2.
> at jess.Value.<init>(Compiled Code)
> at jess.Defrule.substFuncall(Compiled Code)
> at jess.Defrule.addPattern(Compiled Code)
> at jess.Jesp.doParseDefrule(Compiled Code)
> at jess.Jesp.parseDefrule(Compiled Code)
> at jess.Jesp.parseSexp(Compiled Code)
> at jess.Jesp.parse(Compiled Code)
> at jess.Batch.call(Compiled Code)
> at jess.FunctionHolder.call(Compiled Code)
> at jess.Funcall.execute(Compiled Code)
> at jess.Jesp.parseAndExecuteFuncall(Compiled Code)
> at jess.Jesp.parseSexp(Compiled Code)
> at jess.Jesp.parse(Compiled Code)
> at jess.Main.execute(Compiled Code)
> at jess.Main.main(Compiled Code)
> Jess>
>
> This one *appears* to lie in function batch(), and indeed I thought I'd
> found it on line 1869 in Funcall.java:
>
> String filename = vv.get(1).stringValue(context);
>
> Changing this line to
>
> String filename = vv.get(1).resolveValue(context).stringValue(context);
>
> however, apparently had no effect. Sigh. I looked for all occurrences
> of 'pname' in rule LHSs; each one uses one of our UserFunctions
> (oreq), but oreq() is clean (I think):
>
> final class Oreq implements Userfunction {
> public String getName()
> {
> return ("oreq");
> }
>
> public Value call(ValueVector vec, Context context) throws JessException
> {
> Value rval = Funcall.FALSE;
> Value obj = Resolver.asValue(vec.get(1), context);
> int len = vec.size();
>
> System.out.println("oreq called...");
>
> for (int i = 2; i < len; i++) {
> if (obj.equals(Resolver.asValue(vec.get(i), context))) {
> rval = Funcall.TRUE;
> break;
> }
> }
>
> return (rval);
> }
> }
>
> So Ernest, is it my system or Jess?
>
> 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]
---------------------------------------------------------------------