This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-28
Channels
- # announcements (12)
- # babashka (87)
- # beginners (84)
- # calva (22)
- # circleci (4)
- # clj-kondo (46)
- # cljdoc (6)
- # cljsrn (15)
- # clojure (87)
- # clojure-europe (18)
- # clojure-uk (7)
- # clojurescript (20)
- # community-development (3)
- # conjure (1)
- # cursive (13)
- # datomic (14)
- # events (7)
- # fulcro (27)
- # graphql (31)
- # helix (8)
- # jobs-discuss (1)
- # lsp (43)
- # malli (11)
- # meander (64)
- # off-topic (7)
- # pathom (26)
- # polylith (9)
- # practicalli (2)
- # re-frame (33)
- # reagent (2)
- # reitit (5)
- # releases (2)
- # rewrite-clj (2)
- # shadow-cljs (69)
- # specter (5)
- # sql (1)
- # tools-deps (85)
- # tree-sitter (1)
- # vim (3)
I did the first 28 4clojure problems via 4bb to prepare for technical interviews. I got stuck on the Fibonacci problem because last
was returning nil when it shouldn’t. Finally realized I had accidentally redefined last
earlier in the repl session on an earlier problem 🥲😂
In bb, I’m getting Could not resolve symbol: *flush-on-newline* [at <repl>:1:1]
. However I can see it being used in babashka here: https://github.com/babashka/babashka/blob/6d540e2f06acf086adebb2153e1b68a640e64012/src/babashka/impl/clojure/core/server.clj#L250. Is this flag supported in bb?
it doesn't look like that var is currently 'exposed' - as far as that usage, I think of it as almost two different contexts within the codebase - in my head, there's a "clojure context" where things get compiled and all the clojure vars are available, and there's the "sci context", where the vars available are basically those that are exposed by babashka namespace creation (that's my naive take on it)
so, https://github.com/borkdude/sci/blob/5ed2190f3c97de6d30f3aba96362bf6c68e95e90/src/sci/impl/namespaces.cljc#L741 maps all the symbols that are available in "clojure.core" within bb (as far as I know), and *flush-on-newline*
isn't there
And it looks like the babashka.impl.* namespaces are not available at runtime either - so those are just compiled into the binary?
yes. babashka.impl is implementation anyway. These functions are exposed as different (non-impl) namespaces in bb. e.g. clojure.main is exposed to run a REPL. You can use prepl too.
Perhaps @U5H74UNSF can post the code they use in user space for the prepl in a gist?
In Cursive, when it connects to a socket REPL I send some code over to make the REPL work sort of like a prepl, but it’s structured in both directions rather than just one. I’m trying to reproduce that in bb which is where the series of questions are coming from.
issue(s) welcome. proxy support is currently quite limited due to restrictions in graalvm: we can't create new classes at runtime
good question :) bb has intrinsified some usages of proxy so you should consider it unsupported, unless bb explicitly supports it for some use cases / libraries
When I try to do the following: (proxy [Writer] [])
, I get this error: java.lang.IllegalArgumentException: No matching clause: ["
. This is a simplified case, the real one has method implementations but that doesn’t make any difference to this problem. Any ideas?
The above two problems are because I’m trying to implement a basic REPL in userspace. One thing I would need for that is some way to load a file and supply a filename or path so that file and line metadata on the created forms is correctly established. I can’t find one - in Clojure I have to use Compiler/load
but that’s not exposed for obvious reasons. Is there something I can use instead?
I’m experiencing an issue in CI (Github actions) that I’m not locally. I’ve tried v0.4.0 and 0.5.0 with the same error. Any ideas before I debug further?
Could not find /home/runner/.deps.clj/1.10.3.822/ClojureTools/clojure-tools-1.10.3.822.jar
Attempting download from
Cloning: [email protected]:<<internal-lib>>
Downloading: org/clojure/clojure/1.10.3/clojure-1.10.3.pom from central
Downloading: org/clojure/spec.alpha/0.2.194/spec.alpha-0.2.194.pom from central
Downloading: org/clojure/pom.contrib/0.3.0/pom.contrib-0.3.0.pom from central
Error building classpath.
java.lang.NullPointerException
at clojure.tools.deps.alpha.util.dir$canonicalize.invokeStatic(dir.clj:30)
at clojure.tools.deps.alpha.util.dir$canonicalize.invoke(dir.clj:25)
at clojure.tools.deps.alpha.extensions.deps$eval1390$fn__1392.invoke(deps.clj:27)
at clojure.lang.MultiFn.invoke(MultiFn.java:244)
at clojure.tools.deps.alpha$expand_deps$children_task__790$fn__792$fn__793.invoke(alpha.clj:403)
at clojure.tools.deps.alpha.util.concurrent$submit_task$task__505.invoke(concurrent.clj:34)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
(updated to include the downloading of the clojure cli version, see below comment, I initially left out as it had the cloning of an internal repo)I suspect it’s this https://github.com/borkdude/deps.clj/issues/40
You’re welcome to trigger the CI job with different bb versions or tmate dubugging enabled BTW (if it’s possible for someone outside the org to do that)
@U04V15CAJ thanks for taking the time to investigate. Apologies, I should have tried with just clj + git deps, I realise now I had introduced bb + git deps to the project CI at the same time and bb just happened to used first in the build.
No worries! 🙂 Thanks for all your great tools, I’ve been bringing clj-kondo (+ clojure-lsp) and bb into our org recently and really enjoying it. I haven’t gotten to the bottom of it yet no, but it must be something missing from the Github actions environment or something
Oh wow, that’s very strange… on the real project it works locally but not in GH and on the repro project it doesn’t work locally for me either
but what is strange about the repro project is that you refer to the project itself in the deps.edn right?
I’m just recreating the same failure with two projects instead of importing the same project
Does babashka (perhaps via tools.reader) support the :clojure.core/eval-file
/`:line`/`:column` metadata?
I mean, it does support the location metadata, but not sure what eval
is in this context?
Those are relatively new metadata that can be added to individual forms, for e.g. “Send top form to REPL”, to ensure that the forms get the correct location metadata.
I’m thinking about workarounds for the file load issue. I guess I could implement my own file load in bb using read
and eval
in a loop, but they’re form by form and won’t have the location metadata set if I understand correctly.
Actually, sorry - it does, but that’s not what you need over a REPL since it requires a local file. e.g. the nREPL :load-file op sends the file contents.
If you want to be able to connect to a REPL on another machine, load-file doesn’t work. So what’s required is to be able to say “load this file’s worth of code I’m passing, and its filename for metadata purposes is xxx”
But the new metadata forms are useful for the case where you’re sending a single form but want the metadata to be right, e.g. you’re sending a single form from the editor to the REPL.
Because the previous hack that everyone did was to create a string with a whole bunch of newlines and then spaces and then the actual form, to get the form to start at the right line and column, and then to use Compiler/load
Discussion here: https://github.com/cursive-ide/cursive/issues/2113. That’s actually the only place I can find any documentation about this. New in 1.10 apparently.
I was working on a new release of clj-kondo that can do macro-expansion: https://clojurians.slack.com/archives/C06MAR553/p1627470400150500 but I will read your issue later with more attention :)