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 parens.

-W


On Wed, Dec 2, 2009 at 5:02 PM, Jan Willem Lokin <[email protected]> wrote:

> Oops, forgot the attachment, here it is...
>
> -+- JW -+-
>
> 2009/12/2 Jan Willem Lokin <[email protected]>:
> > 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 instead. In that case I get an error:
> >
> > Jess reported an error in routine modify
> >        while executing (modify ?q (bell MyEnum.BIM))
> >        while executing defrule MAIN::change-to-BIM
> >        while executing (run).
> >  Message: Error setting slot value.
> >  Program text: ( run )  at line 23 in file enum3.clp.
> >
> > Nested exception is:
> > Can't convert 'MyEnum.BIM' to required type pkg.MyEnum
> >
> > The error disappears when I parenthesize the offending 'MyEnum.BIM',
> > but that still won't produce the expected output.
> >
> > Any help is appreciated, since I am using Jess in a Java5 application
> > that makes frequent use of enums.
> >
> > -+- JW -+-
> >
>

Reply via email to