@borkdude Not sure if this helps any but in the node-based glob libs it would be *
for any file in current directory and **
for recursion.
*.clj
would look for any files as children in current directory where as **/*.clj
would look for any clojure files in any subdirectory.
Thanks!
Another fs lib related question. I'm building a lib around java.nio but more clojure friendly.
A lot of nio functions return java.nio.file.Path
objects, but in Clojure I think we are more used to <http://java.io|java.io>.File
.
For e.g. glob
function, what would be the most convenient in Clojure world, a vector of Path
or File
?
Returning a wrapped type is always an issue as writing a complete wrapper is a pain and it's less approachable to users, no? Why do you consider protocols a coercion?
Oh I mean returning a thing which implements that protocol but yeah, you can extend the protocol to the known type. But since there are only two, and doesn’t have to be extended I don’t see much benefit
Over just a function
"Just a function" is always a sane choice
both Path -> File and FIle -> Path are present in Paths (and as far as I know are cheap). But I think what clojure code would want is usually a File
I pushed an initial release of this lib to clojars: https://babashka.org/fs Test / review highly appreciated
There is an fs/file
and fs/path
to convert between the types
It is a hard thing and I do not think there is an easy answer
I have chosen to mostly focus on File entry points for functions in stuff I’ve done
We have talked about extending http://java.io with more Path support but I do not have a clear idea about how to do that cleanly
What I currently do: the resulting value can be fed into both a file
and path
function, which converts it to a Path
or File
and all API functions accept both
and maybe that is the only contract I should offer, the concrete return types shouldn't be important. if you need files, use (map fs/file ...)
.
I'm pretty surprised by how much I like https://github.com/hlissner/doom-emacs after toying with it, so polished and nifty. More so compared to this other more popular project that felt all janky and slow and buggy.