missionary 2024-08-30

Absolute Negativity 2024-08-30T13:23:12.846629Z

Is there a difference between these forms? i.e. forking preemptively in try/catch block vs outside following the https://github.com/leonoel/missionary/blob/master/doc/tutorials/hello_flow.md#:~:text=(m/ap%20(let%20%5Bx%20(m/%3F%3C%20flow)%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3B%3B%20pull%20a%20value%20preemptively

(m/ap
    (try
      (let [x (m/?< (m/seed [1 2 3 4 5]))]
        (m/? (m/sleep 500 :x)))
      (catch missionary.Cancelled _ (m/amb))))

  (m/ap
    (let [x (m/?< (m/seed [1 2 3 4 5]))]
      (try (m/? (m/sleep 500 :x))
        (catch missionary.Cancelled _ (m/amb)))))

yes, the latter catches only cancellations from the switch, the former catches all cancellations (from the switch and from the main process)

this pattern will be deprecated eventually, the correct switch behavior is the one implemented in m/cp

🙌 1
Absolute Negativity 2024-08-30T15:17:23.785109Z

The main process means process consuming the flow right?

Absolute Negativity 2024-08-30T16:35:11.846409Z

I see. Thank you.