This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-17
Channels
- # announcements (1)
- # aws (40)
- # babashka (37)
- # beginners (305)
- # chlorine-clover (15)
- # cider (5)
- # cljs-dev (40)
- # clojure (62)
- # clojure-europe (13)
- # clojure-nl (4)
- # clojure-spec (10)
- # clojure-sweden (2)
- # clojure-uk (59)
- # clojurescript (9)
- # core-async (13)
- # cursive (5)
- # data-science (2)
- # datascript (2)
- # datomic (29)
- # emacs (8)
- # fulcro (58)
- # lambdaisland (9)
- # leiningen (2)
- # lumo (3)
- # mid-cities-meetup (1)
- # midje (1)
- # off-topic (28)
- # shadow-cljs (32)
- # spacemacs (3)
- # sql (5)
- # tools-deps (1)
- # tree-sitter (1)
- # vscode (2)
- # yada (2)
is there currently a good way to do piping between processes in bb (since conch is gone)? if not, does the following look interesting? or perhaps there is a way to use it as an external lib?
@sogaiu clojure.java.shell/sh accepts an :in
argument. conch was just a layer over processbuilder, which is in bb. I'm using this directly in e.g. deps.clj:
https://github.com/borkdude/deps.clj/blob/master/src/borkdude/deps.clj#L16-L52
https://github.com/lambdaisland/regal looks cool, might be nice for babashka since is it also helps make regex be a bit more readable.. but it's also kind of redundant since core.re-matches
and core.re-find
are there
Maybe it works as an external lib:
$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {regal
{:git/url "" :sha "e179f20a2ec78d47c8c24257e644ac80a70e33cb"}}}')
$ bb "(require '[lambdaisland.regal :as re]) (re/regex [:range \a \z])"
I don't see any weird errors, but also not a regex result.oh I see! it's because it uses reader conditionals and there is no :bb
reader conditional
awww that's unfortunate, maybe I can convince them to get some bb conditionals, or just fork it.
Did you consider to have a mode where babashka would use the :clj
reader conditional tag? In many cases that will work I'm guessing. I think that's what I saw in one of the patches with :bb
reader conditionals
$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {regal {:git/url "" :sha "42906e57bf45e9d6cb699700ea19e653757f535d"}}}')
$ bb "(require '[lambdaisland.regal :as re]) (re/regex [:range \a \z])"
#"[a-z]"
@jeroenvandijk I think that makes sense. Maybe if the :bb
branch appears before the :clj
branch, it will take that one, else it will take the :clj
branch?
Yeah so the only case where it could go wrong is where the writer intentionally left :bb
out (i.e. meaning no implementation. Right now this seems like a rare case. When it's intentionally left blank we could also demand :bb nil
as that would make it explicitly and unambiguous. So for all the cases where :clj
is compatible (and no :bb
is needed) it would just work
this would only take a minor change in bb, most notably here:
src/babashka/main.clj
330: :features #{:bb}
still forking libs might be a good idea because the original author is not always willing to maintain compatibility with bb maybe
Yeah that's actually a good practise in general, also for :clj
yeah, forking sorry. I don't always do it, but it's a pity when your favourite library has been removed from one day to the other and you didn't fork it
maybe making it explicit in the import instead? like
$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {regal {:git/url "" :sha "42906e57bf45e9d6cb699700ea19e653757f535d" :reader/tag :clj}}}')
that command just produces a classpath using the clojure
tool, which just ignores extra stuff you put inside -Sdeps
but bb could be configurable like --features bb,clj
or something, but that might work out very confusing if some libraries do expect a bb tag and others don't. I think it might be better to just have one kind of behavior for everything
it would be a breaking change, but since the amount of bb-compatible libs in the wild might not be that large yet, it may be a good time to do it now
yeah, I mean these guys: https://github.com/borkdude/babashka/#external-resources
I think I may have found a bug, would you rather I make a small issue with example or just say it here? (it seems the alias for tools.cli is not working? (clojure.tools.cli/parse-opts *command-line-args* cli-options)
works but (tools.cli/parse-opts *command-line-args* cli-options)
doesn't (java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn)