This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-23
Channels
- # announcements (11)
- # babashka (35)
- # beginners (110)
- # calva (2)
- # cider (46)
- # clara (5)
- # clj-kondo (29)
- # cljdoc (4)
- # cljsrn (59)
- # clojure (163)
- # clojure-brasil (3)
- # clojure-europe (24)
- # clojure-italy (2)
- # clojure-nl (10)
- # clojure-sweden (1)
- # clojure-uk (36)
- # clojurescript (58)
- # conjure (24)
- # cursive (19)
- # data-science (14)
- # datascript (1)
- # datomic (10)
- # docker (3)
- # expound (6)
- # figwheel-main (17)
- # fulcro (16)
- # graalvm (1)
- # leiningen (9)
- # malli (11)
- # off-topic (22)
- # parinfer (1)
- # pathom (1)
- # re-frame (18)
- # reagent (18)
- # reitit (3)
- # ring (3)
- # shadow-cljs (8)
- # spacemacs (3)
- # specter (79)
- # sql (20)
- # tools-deps (25)
- # vim (4)
- # xtdb (8)
What's my best option is I need libs not included in bb? I guess I can call jars compiled by lein but it would just be slow, right?
@jpsoares106 Depends on the lib. Not all Clojure programs can be run by babashka.
Here is a list of libraries that are known to work: https://github.com/borkdude/babashka/blob/master/doc/libraries.md
Same, use the BABASHKA_CLASSPATH
environment variable and produce the classpath using a tool like clojure
So:
export BABASHKA_CLASSPATH=$(clojure -Sdeps '{:deps {tick {:mvn/version "RELEASE"}}}' -Spath)
But unfortunately tick doesn't work with babashka yet, since it uses some stuff that's not supported in bb. There is an issue about this in the tick issue tracker
Nice, but let's say I'm already using bb and I realize I need a lib that doesn't work with babahska yet. I still can call its jar as in plain shell, right? My trade off would be the startup time?
@jpsoares106 Btw, this library does work: https://github.com/henryw374/cljc.java-time
The general context would be a project organized not only with clojure code, but using different script languages, like python or ruby. And I'm wondering what could happen if I get to a point where I need a random unknown lib.
I was thinking in splitting functions in different scripts. But if I have some scripts with jar dependencies, the startup time of each would some up as it would be several JVMs, not only one as in common projects.
In that case you might as well just use clojure
to do scripts. Babashka also supports reader conditionals btw, :bb
if that's something you might want to use.
Ok, I'll study the Clojure cli tools a bit more to understand my trade offs, thank you. Bb is a great tool btw. Thank you for creating it.
(clojure.java.browse/browse-url "")
should now work on master for the three major OSes nowHey, are there any specific limitations with SCI and Clojurescript (`thheller/shadow-cljs {:mvn/version "2.10.12"}`)? I'm having a bit of trouble. e.g. The following doesn't work for me
(sci/eval-string "(println 123)") ;; SyntaxError: missing ) after argument list
I have to manually bind println to make it work:
(sci/eval-string "(println 123)"
{:bindings {'println println}}) ;;=> prints 123 in browser console
The first error message seems unexpected, but an error is expected. The reason is that *out*
is not bound by default
Re-binding println
is probably what you want. By default sci does not allow side effects in the outside world, that's the reason
More specifically, {:namespaces {'clojure.core {'println println}}}
is probably what you want
Maybe sci could also have a *print-fn*
like CLJS but the CLJS side of it, but I haven't really explored that yet
One other thing, the js
namespace isn't recognized by default. Do I need to add any functions that I use manually?
e.g.
(sci/eval-string "(js/alert 431)") ;;fail
(sci/eval-string "(js/alert 431)" {:bindings {'js/alert js/alert}}) ;; works
you could try:
{:classes {:allow :all 'js goog/global}}
and see how that works. If it doesn't work out, then look at the interop unit tests in sci for CLJSI'm going to create a PR to write these down in the README. Hopefully that will prevent people from bumping into this. Unless it's already written down somewhere?