#lang imperative-syndicate/test-implementation ;; Uhoh! The current (2018-05-02) scheme for relaying between ;; dataspaces instantiates each pattern when a matching assertion ;; appears and then relays the result on via an ordinary assertion. ;; However, this is probably wrong! If one inner observer monitors ;; ;; (inbound (x _ $y)) ;; ;; while another monitors ;; ;; (inbound (x $z _)) ;; ;; then the second one will see a literal `(discard)` for `z`! (require racket/string) (assertion-struct researcher (name topic)) (test-case [(spawn #:name 'tony (assert (researcher "Tony" "Computering")) (assert (researcher "Tony" "Bicycling"))) (spawn #:name 'alice (assert (researcher "Alice" "Cryptography")) (assert (researcher "Alice" "Bicycling"))) (spawn #:name 'eve (assert (researcher "Eve" "Cryptography")) (assert (researcher "Eve" "Computering")) (assert (researcher "Eve" "Evil"))) (dataspace #:name 'inner-dataspace (spawn #:name 'all-topics (during (inbound (researcher _ $topic)) (on-start (printf "Added topic: ~a\n" topic)) (on-stop (printf "Removed topic: ~a\n" topic)))) (spawn #:name 'all-researchers (during (inbound (researcher $name _)) (on-start (printf "Added researcher: ~a\n" name)) (on-stop (printf "Removed researcher: ~a\n" name)))))] no-crashes (procedure-rename (lambda () (not (memf (lambda (line) (string-contains? line "#s(discard)")) (collected-lines)))) 'no-mention-of-discard))