This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-04
Channels
- # announcements (28)
- # asami (12)
- # aws (3)
- # babashka (69)
- # babashka-sci-dev (34)
- # beginners (52)
- # biff (3)
- # calva (20)
- # clj-kondo (4)
- # cljsrn (4)
- # clojars (1)
- # clojure (90)
- # clojure-czech (2)
- # clojure-europe (33)
- # clojure-nl (11)
- # clojure-norway (35)
- # clojure-seattle (1)
- # clojure-uk (5)
- # clojurescript (87)
- # cursive (10)
- # datascript (5)
- # datomic (35)
- # defnpodcast (1)
- # emacs (8)
- # events (4)
- # fulcro (1)
- # google-cloud (2)
- # graphql (2)
- # hispano (2)
- # honeysql (5)
- # hoplon (2)
- # hugsql (1)
- # jobs (7)
- # kaocha (9)
- # lsp (102)
- # meander (13)
- # observability (7)
- # off-topic (56)
- # overtone (2)
- # pathom (47)
- # podcasts-discuss (1)
- # rdf (30)
- # reagent (16)
- # reitit (1)
- # releases (2)
- # remote-jobs (26)
- # rewrite-clj (10)
- # tools-deps (4)
- # vim (5)
- # vscode (4)
- # xtdb (41)
Not really sure where this belongs in the bb/nbb/sci world, but if you were wondering if you could use scittle in tampermonkey scripts...
// ==UserScript==
// @name Do something
// @namespace
// @version 0.1
// @description try to take over the world!
// @author You
// @require
// @grant none
// @run-at document-body
// ==/UserScript==
(function() {
'use strict';
const script = '(js/console.log "hello world")';
var scriptTag = document.createElement('script');
scriptTag.type = 'application/x-scittle';
scriptTag.appendChild(document.createTextNode(script));
document.body.append(scriptTag);
})();
> where is the strangest place I can use sci This is good thinking! :) We do have a #scittle and #sci as well for this
#babashka 0.8.0 released. Major new feature is the ability to declare pods in bb.edn
. This effort was largely driven by @cap10morgan 👏
See here for an example: https://book.babashka.org/#_pods_in_bb_edn
Full changelogs with many other improvements: https://github.com/babashka/babashka/blob/master/CHANGELOG.md#080-2022-04-04
Next Saturday, @rahul080327 will present about #babashka at NovaLug: https://www.meetup.com/novalug/events/fzklrsydcgbmb/ - feel welcome to join!
How’s this pod/bb.edn work in an https://github.com/redstarssystems/apptemplate project? I keep getting the error below. I tried it the “old” way too with the same results. I see the pod in my ~/babashka/pods/repository/org.babashka/go-sqlite3/0.1.0 manifest.edn, metadata.cache and pod-babashka-go-sqlite3. does it really need _‘s?
14:15 $ bb run
[ ] run 2022-04-04 14:29:09
Execution error (FileNotFoundException) at edu.mywork.www.myproject/eval138$loading (myproject.clj:1).
Could not locate pod/babashka/go_sqlite3__init.class, pod/babashka/go_sqlite3.clj or pod/babashka/go_sqlite3.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
@UH1MELU4U Pods in bb.edn
don't affect Clojure JVM code
So the short answer is: pod config in bb.edn is for babashka code, not for Clojure JVM code. Perhaps @cap10morgan can help you further, it's late here.
Thx… think run is…
(defn run
"Run application (-main function)"
[& args]
(when (:compile-java-sources? (config/get-project-env)) (javac-compile))
(babashka.tasks/clojure (str "-M:run " (apply str (interpose " " args)))))
@UH1MELU4U Can I see the code that's misbehaving somewhere (preferably the whole project)?
@cap10morgan sure, it’s basically the stock app you get when creating an app as described in the readme. https://github.com/xicubed/recevent
@U097654L8 have you tried these pods in your apptemplate?
Nope.
bb run
is run main function of JVM app. So, I guess, running pods here is not good idea. Use pods for babashka tasks, not for JVM code
Pods do work in the JVM but have to include the pods library and use load-pods in the old way.
@UH1MELU4U Sorry, the steps I need to reproduce aren't jumping out at me from that README. Can you connect the dots a little bit more?
or maybe send a docker image that repros?
@cap10morgan It's been said a few times already, but mal is running in the JVM. The JVM does not support running pods declared in bb.edn
oh ok. saw the messages but didn't realize that was the full explanation. thanks!
which JDK classes are available? is there a list, just noticed j.u.c.ExecutorService wasn't
You can look in this file: https://github.com/babashka/babashka/blob/master/src/babashka/impl/classes.clj By request we can add more
Cool. Your older core.async code should now probably also work again in bb btw, due to a fix in 0.8.0
even when I have complicated process stuff that is a good fit for it, the CSP stuff ends up being way too complicated
but I think ExecutorService interface would be good to have, as I can't use it as a typehint to avoid reflection without it
you can install an intermediate version with:
bash <(curl ) --version 0.8.1-SNAPSHOT
once CI has finished buildingbut I got all the code loading now, sadly there is some difference with JVM and bb... the bb version is throwing
java.util.concurrent.CompletionException: java.io.IOException: Output closed
when trying to send to the websocket, where JVM version works... no other exceptions, will need to investigate stillseems the #object[
object just starts out with both input and output closed... no idea why
Maybe @U0EHU1800 has an idea... ? I randomly think of him since we worked on getting the jdk.net.http stuff in bb
but don't understand why
#error {
:cause Not implemented: onOpen
:via
[{:type java.lang.Exception
:message Not implemented: onOpen
:at [babashka.impl.reify$reify_fn$reify__31871 onOpen reify.clj 64]}]
:trace
[[babashka.impl.reify$reify_fn$reify__31871 onOpen reify.clj 64]
[java.lang.reflect.Method invoke Method.java 566]
[sci.impl.Reflector invokeMatchingMethod Reflector.java 172]
[sci.impl.interop$invoke_instance_method invokeStatic interop.cljc 39]
[sci.impl.evaluator$eval_instance_method_invocation invokeStatic evaluator.cljc 188]
[sci.impl.analyzer$analyze_dot$reify__9342 eval analyzer.cljc 820]
[sci.impl.analyzer$return_if$reify__9276 eval analyzer.cljc 653]
[sci.impl.fns$fun$arity_2__7886 invoke fns.cljc 107]
[babashka.impl.reify$reify_fn$reify__31871 onOpen reify.clj 64]
...
I don't get why this is the fallback that (reify WebSocket$Listener)
I'd expect that to throw always as it implements nothing
reify docs say
Methods should be supplied for all methods of the desired
protocol(s) and interface(s).
so I guess we are in undefined behaviour territory@U11SJ6Q0K Nice! I'll look into that incompatibility if you're willing to create an issue
I just tried with java.lang.Comparable
and JVM clojure also throws exception when trying to invoke an undefined method
I'm trying to find a good repro case and ran into
user=> (import '(java.util Comparator))
java.util.Comparator
user=> (def c (reify Comparator))
No matching clause: java.util.Comparator
^ that works in jvm clojureAnother version of neil published. Adds neil dep search
command:
https://twitter.com/borkdude/status/1511084119698165768
I have encountered some strangely unhelpful error messages / stacktraces from babashka in some cases. This is my minimal script to reproduce:
#!/usr/bin/env bb
(ns my)
(defn myfn []
(assert false))
(binding []
(myfn)
(try 1 (catch Throwable e)))
When I run this with babashka v0.8.0 I get this output with no context or location info:
----- Error --------------------------------------------------------------------
Type: java.lang.AssertionError
Message: Assert failed: false
When either the empty binding is removed (unwrapped), or the try-catch is removed, the resulting error message is much better:
----- Error --------------------------------------------------------------------
Type: java.lang.AssertionError
Message: Assert failed: false
Location: /home/jan/clj/automove/./errtest.bb:8:3
----- Context ------------------------------------------------------------------
4: (defn myfn []
5: (assert false))
6:
7: (binding []
8: (myfn)
^--- Assert failed: false
9: )
----- Stack trace --------------------------------------------------------------
my/myfn - /home/jan/clj/automove/./errtest.bb:4:1
my - /home/jan/clj/automove/./errtest.bb:8:3
Is this some known limitation or a bug?Thank you, I opened https://github.com/babashka/babashka/issues/1232