<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3314" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=687465715-28042008><FONT face=Arial size=2>Suppose I have a
"Measurement" class, with a getName() method that returns a String
and with a getValue() method that returns an Object. Sometimes the
Object is a String, sometimes a Integer, sometimes a Double. <SPAN
class=687465715-28042008><FONT face=Arial size=2>I know that a "Foo"
Measurement must be an integer, so I could cast (or otherwise coerce) into
a form that can be compared with a constant integer (or other
"Foo" Measurement).</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=687465715-28042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=687465715-28042008><FONT face=Arial size=2>How do I handle this
type of value in the LHS of the rule?</FONT></SPAN></DIV>
<DIV><SPAN class=687465715-28042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=687465715-28042008><FONT face=Arial
size=2>when</FONT></SPAN></DIV>
<DIV><SPAN class=687465715-28042008> <FONT face=Arial
size=2>$m : Measurement(name == "Foo", value < 10)</FONT></SPAN></DIV>
<DIV><SPAN class=687465715-28042008><FONT face=Arial
size=2>then</FONT></SPAN></DIV>
<DIV><SPAN class=687465715-28042008> <FONT face=Arial
size=2>System.out.println("It's less than ten!");</FONT></SPAN></DIV>
<DIV><SPAN class=687465715-28042008><FONT face=Arial
size=2>end</FONT></SPAN></DIV>
<DIV><SPAN class=687465715-28042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=687465715-28042008><FONT face=Arial size=2>I'd also like to be
able to test for the Objects type (instanceof). I'm using java as my dialect, if
that makes a difference. For other reasons I'd like to avoid having
to either subclass Measurement or add type-specific value
accessors.</FONT></SPAN></DIV>
<DIV><SPAN class=687465715-28042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=687465715-28042008><FONT face=Arial
size=2>-Russ</FONT></SPAN></DIV></BODY></HTML>