Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type metadata to flow and task functions like ap, sp, via etc? #110

Open
den1k opened this issue Apr 22, 2024 · 0 comments
Open

Add type metadata to flow and task functions like ap, sp, via etc? #110

den1k opened this issue Apr 22, 2024 · 0 comments

Comments

@den1k
Copy link

den1k commented Apr 22, 2024

I have a spreadsheet app (build on electric 😉) with a sandboxed runtime that can evaluate Clojure. In order to support use cases with intermittent return values such as streaming users should be able to write code that returns a flow. The runtime should the be able to identify that the evaluated code (e.g. (m/ap ...) is in fact a flow and run it appropriately.

to illustrate:

(defn yield-intermittent-values-middleware [x]
  (case (some-> x meta :missionary.type)
    :flow (run-flow-and-yield-intermittent-values x)
    x))

(let [user-code                                  `(m/ap '...)
      user-code-if-missionary-added-type-as-meta `(with-meta
                                                    ~user-code
                                                    {:missionary.type :flow})
      user-code-with-middleware                  (list 'yield-intermittent-values-middleware
                                                       user-code-if-missionary-added-type-as-meta)]
  ;; runtime
  (runtime-eval user-code-with-middleware))

Generally this could be useful for missionary middleware and other cases dynamic evaluation in user land.

@leonoel leonoel mentioned this issue Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant