I think [EMAIL PROTECTED] wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
Hi!
Jess already offers single inheritence capabilities [.]
I've already had situations where multiple inheritence would have been very
useful. Imagine, for example, a set of Java interfaces (e.g., Publisher,
Subscriber, StateReader, StateWriter), each defining, among others, getter
and setter operations for Bean properties. When defining (defclass)es for
Java classes implementing more than one of these interfaces it would be
nice to be able to mirror the inheritance/implementation hierarchy. In that
case rules could be written to handle the aspects modeled by the interfaces
one by one.
Would it be very complex to add multiple inheritance to Jess?
Thomas
It would not be terribly complex, but I believe it would entail a
noticeable performance hit. Right now slot names are turned into
absolute slot indexes when rules are compiled. Then to evaluate a
Rete-network test, a node just needs to fetch the Value within a Fact
at a specific numeric offset. This only works with single
inheritance. Child classes just extend the range of offsets, but the
inherited slots are at the same offsets as they are in the parent
class.
Now, to do multiple inheritance, you've got to do something like what
C++ does, which involves more some runtime lookup. Each fact would
need to contain pointers to one or more "vtables," one for each
inherited interface. The vtable entries would match offsets within a
base type to offsets within a child type. With some careful
programming, I think you could avoid doing any runtime slot-name
lookup; but still the pointer-chasing and record-keeping overhead
would both have a noticeable impact.
So although the usefulness of this seems apparent even to me,
implementing it is not a high priority. It would strongly violate the
"only pay for what you use" philosophy I've tried to adhere to in
designing Jess.
-
Ernest Friedman-Hill
Distributed Systems ResearchPhone: (925) 294-2154
Sandia National LabsFAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
-
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
-