Menu

#15 defmodule focus stack corruption

CLIPS
closed
None
5
2025-05-22
2024-06-06
No

Please see the following sequence of actions that leads to some possibly unexpected behavior:

CLIPS> (get-current-module)
MAIN
CLIPS> (assert (f 1))
<Fact-1>
CLIPS> (facts)
f-1     (f 1)
For a total of 1 fact.
CLIPS> (defmodule FOO)
CLIPS> (list-focus-stack)
MAIN
CLIPS> (defrule do-it (f ?f) => (focus MAIN) (assert (f ?f)))
CLIPS> (assert (f 2))
<Fact-2>
CLIPS> (facts)
f-2     (f 2)
For a total of 1 fact.
CLIPS> (run)
CLIPS> (get-current-module)
FOO
CLIPS> (facts)
f-2     (f 2)
For a total of 1 fact.
CLIPS> (list-focus-stack)
CLIPS> (pop-focus)
FALSE
CLIPS> (focus MAIN)
TRUE
CLIPS> (facts)
f-1     (f 1)
For a total of 1 fact.
CLIPS> (list-focus-stack)
MAIN
CLIPS> (pop-focus)
MAIN
CLIPS> (list-focus-stack)
CLIPS> (get-current-module)
MAIN

Discussion

  • Gary Riley

    Gary Riley - 2024-06-07

    What's the unexpected behavior in this example?

     
    • Ryan Johnston

      Ryan Johnston - 2025-05-22

      This was a misunderstanding on my part. This ticket can be closed

       
  • Gary Riley

    Gary Riley - 2025-05-22
    • status: open --> closed
    • assigned_to: Gary Riley
     

Anonymous
Anonymous

Add attachments
Cancel





Auth0 Logo