(deffact somefacts 
        (head1 abc))
is asserted as (MAIN::head1 abc)

(defmodule SUB)
(deffact SUB::somemorefacts 
        (head1 def))
is also asserted as (MAIN::head1 def)

Shouldn't the latter be asserted as (SUB::head1 def)?
In fact, it only gets asserted in the module only when specified like
(deffact SUB::somemorefacts 
        (SUB::head1 def))

More specifically, any facts in the deffact statement, defined before a fact
definition referencing a module, are asserted to the MAIN:: module.  All
facts after a specific module fact are asserted to that same specific
module.

Ex:
(defmodule SUB)
(deffact SUB::somefacts
        (f1 s1)
        (f1 s2)
        (SUB:f1 s3)
        (f1 s4))
yields...
        f-1 (MAIN::f1 s1)
        f-2 (MAIN::f1 s2)
        f-3 (SUB::f1 s3)
        f-4 (SUB::f1 s4)


Effectively, all deffacts, regardless of the defmodule they follow, by
default extend the MAIN:: repository of facts and are accessable to all
modules.  This is unlike the assert statement, when executed in a module,
which asserts the fact with the <module>:: prefix on the fact as a default.

I have a related question about modules and the scope of facts.

If the same fact head is defined in both modules, like ...

        (deffact MAIN::somefacts
                (head1 abc)
        ...
        (deffact SUB::someotherfacts
                (SUB::head1 def)

then a rule in module SUB will not fire with the (head1 abc) fact.  As in...

        (defrule SUB:rule1 
                (head1 ?a) 
                =>
                (printout t ?a crlf))

This only prints "def".

Shouldn't the facts defined as MAIN:: be accessable to all modules even when
the names of the facts are the same?


---------------------------------------------------------------------
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]
---------------------------------------------------------------------

Reply via email to