=======
Summary
=======
[6.1p8]
(read) quietly reads a variable-like lexeme "?x" from a text file,
and returns an atom "?x", without ever trying to evaluate it as a
Jess variable.
[7.1b1]
(read) throws "No such variable x" in Context.getVariable().
(explode$) converts a string "?x" to gibberish like "^B".
=========
Background
=========
I've used Jess 6.1{p6-p8} for two years to read a raw Jess-like
file "as plain text", using the (read) function. I generate this file
externally by converting from "SWRLj", which is SWRL with some
extensions borrowed verbatim from Jess.
In particular, a SWRL rule contains variables using the same syntax
as Jess, namely "?x", i.e. a leading "?" character, followed by an
alpha-numeric-underscore identifier. These variables appear verbatim
in my input file. I must do my own extra rule rewriting before I eval these
"rules" in Jess, so my intent is to process this file as dumb text.
=======
Sleuthing
=======
I traced this behavior change to a real change in the Jess source code.
[6.1p8]
[ Funcall.java | class Read | call() ]
return jt.tokenToValue(null); // passes a null context
[ JessToken.java | class JessToken | tokenToValue(context) ]
case RU.VARIABLE:
if (context != null)
// ... but it is null, so ...
else
return new Value("?" + m_sval, RU.ATOM);
It returns an atom that is lexically identical to the variable name