JESS: Mysterious behavior when using Java5 enums in Jess

2009-12-02 Thread Jan Willem Lokin
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

JESS: Re: Mysterious behavior when using Java5 enums in Jess

2009-12-02 Thread Jan Willem Lokin
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

RE: JESS: Re: Mysterious behavior when using Java5 enums in Jess

2009-12-02 Thread Friedman-Hill, Ernest
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

Re: JESS: Re: Mysterious behavior when using Java5 enums in Jess

2009-12-02 Thread Wolfgang Laun
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

Re: JESS: Re: Mysterious behavior when using Java5 enums in Jess

2009-12-02 Thread Jan Willem Lokin
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