Fork me on GitHub
#babashka
<
2022-06-09
>
zugnush01:06:32

Is lanterna only a pod now?

bb --describe
{:babashka/version   "0.8.156"
...
 :feature/lanterna true
...}
bb
Babashka v0.8.156 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.

user=> (require '[lanterna.terminal :as lit])
java.lang.Exception: Could not find namespace: lanterna.terminal. [at <repl>:1:1]
seems to have been like this in 0.8.2 too

borkdude06:06:34

Lanterna was never part of bb, it was behind a feature flag

borkdude06:06:05

:feature/lanterna true
This is a bug probably

borkdude06:06:32

Fixed on master (by printing false)

Sam Ritchie14:06:31

With the :bb reader form (for cljc files, probably getting the term wrong) is there a way to do something like #{:bb :cljs}, ie, to specify a reader fork for two of the three possible choices?

Alex Miller (Clojure team)14:06:51

no, but you can use :default as a fallthrough if that helps

❤️ 1
Sam Ritchie14:06:10

@U064X3EF3 is the set idea interesting at all? I'm sure it's come up, I just wasn't sure where to find a canonical discussion

Alex Miller (Clojure team)14:06:48

I think it's unlikely we're going to make a change in this area anytime soon

Alex Miller (Clojure team)14:06:14

was considered during the implementation and decided it was not worth the complexity

👍 1
Sam Ritchie14:06:48

Makes sense to wait until it's obviously needed if ever

Sam Ritchie14:06:35

Reader conditional! That's the term.

teodorlu14:06:09

Is Nix still supported for installing Neil? As far as I can tell, the latest published version is 0.0.23 on Nixpkgs unstable.

$ which neil
/home/teodorlu/.nix-profile/bin/neil

$ ls -l $(which neil)
lrwxrwxrwx 1 teodorlu teodorlu 64 1970-01-01 01:00 /home/teodorlu/.nix-profile/bin/neil -> /nix/store/rf2fykxl71q5dfy7vs2gkb4m3fdld8k8-neil-0.0.23/bin/neil
Downloading the binary directly gives me neil 0.0.31.

borkdude14:06:27

I don't manage the nix package but feel free to bump it :)

👍 1
jose08:06:03

@U3X7174KS I created a PR: https://github.com/NixOS/nixpkgs/pull/177148 Until it gets merged, you can run it with nix run github:jlesquembre/nixpkgs/neil-update#neil -- --version

teodorlu08:06:46

Great, thanks!

amar21:06:13

Any ideas why I can't call .get on an instance of org.httpkit.DynamicBytes ? Unfortunately I'm still clueless about sci internals.

sci.impl.analyzer/return-call/reify/eval            analyzer.cljc: 1149
                                                /sci.impl.vars.SciVar                vars.cljc:  329
                                                  clojure.core/update                 core.clj: 6231
                                             sci.impl.fns/fun/arity-1                 fns.cljc:  106
                             sci.impl.analyzer/analyze-new/reify/eval            analyzer.cljc:  858
                                                    clojure.core/mapv                 core.clj: 6970
                                                  clojure.core/reduce                 core.clj: 6885
                                                                  ...                               
                                                 clojure.core/mapv/fn                 core.clj: 6979
                               sci.impl.analyzer/analyze-new/reify/fn            analyzer.cljc:  859
                             sci.impl.analyzer/analyze-dot/reify/eval            analyzer.cljc:  820
                   sci.impl.evaluator/eval-instance-method-invocation           evaluator.cljc:  185
                             sci.impl.utils/throw-error-with-location               utils.cljc:   32
                             sci.impl.utils/throw-error-with-location               utils.cljc:   34
clojure.lang.ExceptionInfo: Method get on class org.httpkit.DynamicBytes not allowed!
    column: nil
      file: "somefile.clj"
      line: nil
      type: :sci/error

borkdude21:06:53

Every class has to be explicitly mapped in a config to be available for Java interop. Maybe you can file an issue with what you're trying to accomplish. Isn't this an internal class or is it a public API? This kind of information would be useful.

borkdude21:06:55

Probably :as :bytes would get you the same right?

amar21:06:06

It's a public class. I'm using babashka as an http proxy and wanted to not deserialize the bytes in the http response body and forward it on. Yeah thanks let me try :as :bytes

amar23:06:11

:as :byte-array seems to have worked. Appreciate the help 🙂

amar23:06:33

Turns out :as :byte-array still unzips the content. :as :none is what I'd like to use but that returns the DynamicBytes instance. Probably should be handled within httpkit. Relevant issue https://github.com/http-kit/http-kit/issues/400