In the JessWiki I found some info about how to use Java5 enums in
Jess. It turns out that it works OK with plain Jess facts, as
illustrated by enum2.clp in the attached archive, which produces the
output that I expect. However, the behavior is mysteriously different
when I use shadow facts
Oops, forgot the attachment, here it is...
-+- JW -+-
2009/12/2 Jan Willem Lokin jwlo...@gmail.com:
In the JessWiki I found some info about how to use Java5 enums in
Jess. It turns out that it works OK with plain Jess facts, as
illustrated by enum2.clp in the attached archive, which produces
Hi Jan,
No mystery, just a few subtle things wrong. Remember that MyEnum.BIM is always
just a symbol, while (MyEnum.BIM) is a function that returns the object BIM in
the enumeration MyEnum (given that you've imported MyEnum). The version of the
program with enums should NEVER use a bare
You must parenthesize *every* reference to an enum constant; otherwise
they'll be
considered being plain symbols.
If this causes you parenthesitis retinae, you may find
http://www.jessrules.com/jesswiki/view?BindEnumUserFunction
useful, as it binds enums to variables, so you can omit the
So it seems that I got bitten by the fact that the dot is subtly
overloaded. Small surprise, since I never use dots in names. Would it
be an idea to have some mode of operation where dots in names are
flagged as warnings? Or is this a practical impossibility?
Alternatively it would already be