This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-16
Channels
- # babashka (17)
- # calva (35)
- # clerk (31)
- # cljs-dev (3)
- # clojars (1)
- # clojure (16)
- # clojure-europe (4)
- # clojurescript (38)
- # clojutre (2)
- # cursive (8)
- # datomic (16)
- # exercism (5)
- # fulcro (5)
- # gratitude (3)
- # hyperfiddle (55)
- # joyride (1)
- # lsp (40)
- # off-topic (6)
- # portal (64)
- # practicalli (1)
- # reitit (3)
- # releases (1)
- # shadow-cljs (38)
- # sql (1)
- # tools-deps (8)
- # xtdb (9)
I'm starting to get familiar with babashka/fs
, and I it's joyful to work with. The https://github.com/babashka/fs/blob/master/API.md is concise and easy to read. The operations in the babashka.fs
namespace compose well. Compared to the manual string operations I've been doing before, fs is so much better! 😸 ❤️
I also really appreciate that babashka/fs
doesn't have fluff. It feels like learning to work with the file system, not working with some weird abstraction on top of the file system.
I still do string concatenation sometimes (str dir "/" fname)
- doesn't seem to hurt
My understanding is that forward slashes are fine on windows as well > I've never found it documented anywhere, but the JDK classes let you use slashes regardless of whether you're on Windows or not. (You can see this in the JDK source, where it explicitly converts path separators for you.) https://stackoverflow.com/questions/19762169/forward-slash-or-backslash
Yeah, it plays no nicely with strings. You can use strings or fs objects at any place without hassle, so the abstractions are all opt-in!
Yeah exactly - that's nice as well, I'm just not sure I want to drag people towards fs/path
instead of str
in code review
There are some situation in which slashes don't work on Windows (it might be with mixed backslashes and forward slashes), but I don't remember them off the top of my mind. I think it's usually better to use (str (io/file x "foo" "bar"))
or fs/file
than doing the string thing manually with (str x "/" "foo")
Is it possible to use s/instrument
and expound
together in Babashka? When I try to set it up using alter-var-root
the instrumentation is working but the pretty printing doesn't work
Example: https://gist.github.com/rads/cad563ed2a14fd1d00be17310dfd6efb
Yes, if I remove the Babashka-specific stuff from my example and run with clojure
, I get the following output:
Execution error - invalid arguments to user/foo at (expound2.clj:22).
expound2.clj:22
-- Spec failed --------------------
Function arguments
("bar")
^^^^^
should satisfy
int?
-------------------------
Detected 1 error
Don't know. Worth posting an issue. You can debug by adding babashka/spec.alpha to your deps and then looking into what should happen around the explain-out stuff
I think I figured out why the behavior is different between Clojure and Babashka. It looks like there is behavior in clojure.main/main
to run explain-out
in the error reporter: https://github.com/clojure/clojure/blob/d0175370c05ef12304aa46236012bc56059c3ddc/src/clj/clojure/main.clj#L326-L341
So it's nothing to do with expound
, it's the difference between how Clojure and Babashka print exceptions by default