This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-19
Channels
- # aws (2)
- # babashka (4)
- # babashka-sci-dev (7)
- # beginners (92)
- # biff (7)
- # calva (64)
- # cider (2)
- # cljsrn (14)
- # clojure (8)
- # clojure-australia (5)
- # clojure-europe (14)
- # clojure-norway (8)
- # clojure-spec (36)
- # clojurescript (19)
- # component (15)
- # cursive (1)
- # data-science (6)
- # girouette (5)
- # hyperfiddle (3)
- # juxt (5)
- # leiningen (10)
- # lsp (7)
- # malli (12)
- # nbb (90)
- # polylith (1)
- # portal (11)
- # rdf (7)
- # reagent (6)
- # reitit (40)
- # remote-jobs (1)
- # shadow-cljs (21)
- # specter (5)
- # squint (83)
- # tools-deps (17)
- # vim (7)
If I have a function ref in a config edn of some sort, is requiring-resolve
the best way to resolve and use it? What is a good approach to eval fns that are specified in edn
files?
ex:
{:fn-to-exec 'clojure.string/join}
If it's just a qualified symbol, then requiring-resolve
should work.
If it's a function definition, like (fn [x] (do-stuff x))
, then you'll need to use eval
.
no, not a fn
. Just a symbol
yes, requiring-resolve
is a good thing to apply here
this is actually a long-standing problem we've been talking about in the clojure team. most systems eventually have this need and we've been considering a standard tagged literal or something that could be resolved on read. like imagine #'foo/bar that reads as a real var (or #var foo/bar
or something else)
see https://clojure.atlassian.net/browse/CLJ-2165 for some work on this
otherwise you have to read edn, then apply some walk to resolve certain things back to fns/vars