This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-09
Channels
- # babashka (63)
- # beginners (97)
- # biff (11)
- # chlorine-clover (5)
- # cider (46)
- # clara (2)
- # clj-kondo (34)
- # clojure (65)
- # clojure-austin (1)
- # clojure-europe (9)
- # clojure-france (10)
- # clojure-italy (11)
- # clojure-nl (3)
- # clojure-spec (29)
- # clojure-uk (5)
- # clojuredesign-podcast (1)
- # clojurescript (56)
- # clr (6)
- # component (17)
- # conjure (5)
- # core-typed (5)
- # cursive (23)
- # data-science (5)
- # datahike (3)
- # dirac (3)
- # emacs (20)
- # fulcro (17)
- # graalvm (10)
- # graphql (8)
- # helix (99)
- # honeysql (7)
- # jobs-discuss (9)
- # juxt (9)
- # leiningen (14)
- # malli (3)
- # meander (6)
- # off-topic (77)
- # pathom (7)
- # re-frame (12)
- # reagent (8)
- # reitit (10)
- # restql (1)
- # shadow-cljs (22)
- # spacemacs (10)
I think defprotocol
, extend
, extend-type
, etc. are in a pretty good shape in the defprotocol
branch of sci and babashka. Examples from clojuredocs seem to work. If there aren't any bugs discovered before tomorrow I'll merge to master and do a new release with this.
I don't know if it's a bug or what, but a little bit ago I was trying to use https://github.com/cognitect-labs/test-runner.git to run my babashka tests
running with clojure:
$ clojure -A:clj:test
Running tests in #{"test"}
WARNING: print already refers to: #'clojure.core/print in namespace: empath-test, being replaced by: #'empath-test/print
Testing empath-test
Ran 2 tests containing 12 assertions.
0 failures, 0 errors.
Running with new bb with defprotocol:
$ ./bb-defprotocol -cp $(clojure -R:test -Spath) -m cognitect.test-runner
Running tests in #{"test"}
Testing user
Ran 0 tests containing 0 assertions.
0 failures, 0 errors.
hm, this is going to take longer than I thought I can't just add tools.namespace to my deps edn as a local root and start println debugging
I've tried tools.namespace and I think it didn't work because of a deftype
somewhere (which bb doesn't yet support)
oh this was the issue:
`
$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {org.clojure/tools.namespace {:mvn/version "1.0.0"}}}')
$ ./bb "(require '[clojure.tools.namespace.find])"
clojure.lang.ExceptionInfo: Unable to resolve classname: http://java.net.URLClassLoader [at clojure/java/classpath.clj, line , column ]
A library that does work is https://github.com/clj-commons/camel-snake-kebab
I also tried hiccup, but that has a deftype too: https://github.com/weavejester/hiccup/blob/abc97943ee0fb72e5c94f8fac170be5535f9f2d4/src/hiccup/util.clj#L60
oh I see:
$ clj -e '(.readPassword (System/console))'
#object["[C" 0x743cb8e0 "[C@743cb8e0"]
clojure.lang.ExceptionInfo: Method readLine on class java.io.Console not allowed! [at \\....\, line 19, column 30]
actually, didn't need password prompt after all, but got curious where that "http://java.io.Console not allowed!" came from
but thinking that System/console is a good addition, since you can do password prompts with bb then
$ ./bb -e '(println "Type password:") (let [pw (.readPassword (System/console))] (String. pw))'
Type password:
<here is an icon of a key I could not copy paste>
"123"
The above should be possible with releases just posted to https://clojurians.slack.com/archives/CSDUA8S6B/p1591713855009900 (cc @viesti)
Also seems to work on Windows:
C:\Users\borkdude\Downloads>bb "(println \"Type password:\") (String. (.readPassword (System/console)))"
Type password:
<nothing to see here>
"123"
Maybe babashka for me is just a tool to prepare my migration back to Windows 😉
now getting greedy, I wonder if https://github.com/weavejester/hashp could work with bb... 🙂
$ bb-defprotocol -cp $(clojure -Sdeps '{:deps {com.taoensso/nippy {:mvn/version "2.14.0"}}}' -Spath) "(require '[taoensso.nippy :as nippy])"
clojure.lang.ExceptionInfo: Unable to resolve classname: java.io.DataInputStream [at taoensso/nippy.clj, line , column ]
Converting the examples in this blog to use bb instead of bash + jq would be awesome I think :) https://medium.com/circuitpeople/aws-cli-with-jq-and-bash-9d54e2eabaf1
I took a look at the docs but didnt find an definitive answer
lets say I want to use https://github.com/clj-commons/camel-snake-kebab in a babashka script (assuming its compatible with babashka), whats the easiest way to use it in the project? deps.edn
+ something?
@plins What a co-incidence. I just merged the defprotocol branch in which the tests for camel-snake-kebab now are running with babashka on CI. https://github.com/borkdude/babashka/blob/14cd18f50f4298b0ee623bd4992c704b5a4d6935/script/lib_tests/camel_snake_kebab_test#L12
So it should be able to run with the new binaries from master (https://clojurians.slack.com/archives/CSDUA8S6B/p1591737307011100) using the way shown in the linked script.