follow-up question: is there an equivalent of load-file for (require)? basically i want to add an "alias" from one namespace to another
oh load looks promising
hm no that doesn't work because it also processes the ns declaration at the top
oh here looping over ns-publics and calling intern worked well
Remember to handle metadata when doing that, for docstrings etc on the "alias" you are interning...
(in general, folks usually say "don't do that" about importing vars from one ns into another)
fortunately i'm only doing this in tests, so i have a binary yes/no for whether this scheme works
Yup, it should work. Kinda puzzled why you need it (only) in tests tho'?
i am doing Hacks ™️ with SCI, and i'm trying to test the guest code in unit tests, including (require)s with a custom :load-fn https://clojurians.slack.com/archives/C03S1KBA2/p1759015928018869?thread_ts=1759012789.378569&cid=C03S1KBA2
i am getting the feeling that no one has tried to do this before 😅
my stacktraces are truly impressive in size tbh, the latest one had at least 300 frames
a lot of them are being filtered by kaocha/*stacktrace-filters* so i'm not exactly sure
Ah, yes, it does sound like you're in uncharted territory...
i wonder if kaocha lets me set a custom stacktrace printer so i don't have to read the sci/stacktrace hashmap
i guess i can just wrap all the SCI invocations in a try/catch
oh yeah this is way better
While I never really understood the reason behind "don't do that" for interning vars from other namespaces into a new one. I've got an alternative where you just create an identical function or macro that calls into the other one. Which maybe is "cleaner".
that works if you know all the variables you want to rebind, but not if you're getting the list programatically
Oh no, I meant as a macro, like what I have in this lib: https://github.com/xadecimal/expose-api/blob/main/src/com/xadecimal/expose_api.clj#L40-L70 It dynamically generates an identical function of the same name, doc-string, arity, whose body calls the one from the other namespace.
yes, i am saying that the usage there is (expose-vars [#'impl/defn #'impl/cool], so you need to know the names defn and cool ahead of time
for the namespace i was re-exporting, there were 40 or so variables and it didn't make sense to do it manually
(ns-publics 'clojure.string)
;;> {ends-with? #'clojure.string/ends-with?, capitalize #'clojure.string/capitalize, reverse #'clojure.string/reverse, join #'clojure.string/join, replace-first #'clojure.string/replace-first, starts-with? #'clojure.string/starts-with?, escape #'clojure.string/escape, last-index-of #'clojure.string/last-index-of, re-quote-replacement #'clojure.string/re-quote-replacement, includes? #'clojure.string/includes?, replace #'clojure.string/replace, split-lines #'clojure.string/split-lines, lower-case #'clojure.string/lower-case, trim-newline #'clojure.string/trim-newline, upper-case #'clojure.string/upper-case, split #'clojure.string/split, trimr #'clojure.string/trimr, index-of #'clojure.string/index-of, trim #'clojure.string/trim, triml #'clojure.string/triml, blank? #'clojure.string/blank?}I'm starting a new webapp. Ideally I'd like to provide support for passkeys out of the box. I don't think that either buddy or friend have passkey support? I assume my best option would therefore be Auth0, Cognito or similar? Are there any other options I should be considering?
I've been finding workos nice. Not using passkeys, but they appear to support them