profile
viewpoint
Michiel Borkent borkdude Amersfoort https://michielborkent.nl Clojure developer

borkdude/babashka 1246

A Clojure babushka for the grey areas of Bash (native fast-starting Clojure scripting environment)

borkdude/carve 112

Carve out the essentials of your Clojure app

borkdude/advent-of-cljc 43

Cross platform Clojure Advent of Code solutions

borkdude/babashka.curl 42

A tiny curl wrapper via idiomatic Clojure, inspired by clj-http, Ring and friends.

borkdude/boot-bundle 42

boot-bundle: managed dependencies for boot, the clojure build tool

borkdude/balcony 24

Should I water my balcony?

borkdude/balcony-hs 14

Should I water my balcony?

borkdude/aoc2017 13

Advent of Code 2017

babashka/babashka-sql-pods 11

Babashka pods for SQL databases

push eventborkdude/babashka

Michiel Borkent

commit sha 71004afd01b9886921fe0ad0dd5763f902b93294

sci: add class?

view details

push time in a day

push eventborkdude/sci

Michiel Borkent

commit sha f28687c661d5f862da4f60d2ae684174b8e54519

Add class?

view details

push time in a day

pull request commentborkdude/carve

exit with status code 1 when the report is not empty

@AndreaCrotti I'd rather not use with-redefs, but test for real if the program returns exit code 1 in case of unused vars. See clj-kondo how this is done. There is -main which calls main. main returns the exit code and this is tested in the unit tests. -main then simply does (System/exit (main ...)).

AndreaCrotti

comment created time in a day

push eventbabashka/babashka.pods

Michiel Borkent

commit sha 1245cb26baf6b135abc349b3b25dbd6ca82799bc

Update README.md

view details

push time in 2 days

push eventborkdude/babashka

Michiel Borkent

commit sha 3386874f0351e4435d961e2e837baebe5a61efc6

Add blog by Andrew Montalenti

view details

push time in 2 days

issue closedborkdude/babashka

exit code for failed tests is 0

bb -e "(require '[clojure.test :as t])" -e '(t/deftest test (t/is (= 3 4)))' -e '(test)'

should have a non-zero exit code.

closed time in 2 days

dpsutton

issue commentborkdude/babashka

exit code for failed tests is 0

On second thought, it shouldn't:

$ clj -e "(require '[clojure.test :as t])" -e '(t/deftest test (t/is (= 3 4)))' -e '(test)'
WARNING: test already refers to: #'clojure.core/test in namespace: user, being replaced by: #'user/test
#'user/test

FAIL in (test) (NO_SOURCE_FILE:1)
expected: (= 3 4)
  actual: (not (= 3 4))
$ echo $?
0

My bad :)

dpsutton

comment created time in 2 days

issue openedbabashka/babashka.nrepl

Error when completing (System/getProperty ..)

#error {
 :cause No namespace: System found
 :via
 [{:type clojure.lang.ExceptionInfo
   :message No namespace: System found [at line 1, column 7]
   :data {:type :sci/error, :line 1, :column 7, :message No namespace: System found [at line 1, column 7]}

created time in 2 days

push eventborkdude/clj-kondo

Michiel Borkent

commit sha 4b42da6fb17764f31a754c4cbe107433255f79d7

wording

view details

push time in 2 days

push eventborkdude/clj-kondo

Michiel Borkent

commit sha 30ee0e74c71f4ebfc00e91b7d024ad429596d41e

Add note about :meta

view details

push time in 2 days

pull request commentborkdude/babashka

Feature: Datomic Client

Btw, another cool idea is to make a pod out of this, similar to babashka-sql-pods. See https://github.com/babashka/babashka.pods and https://github.com/babashka/babashka-sql-pods.

bhurlow

comment created time in 2 days

pull request commentborkdude/babashka

Feature: Datomic Client

Re java.library.path: you can also set the library path dynamically in a babashka program: (System/setProperty ...). Maybe that helps?

bhurlow

comment created time in 2 days

pull request commentborkdude/babashka

Feature: Datomic Client

Re: The client test requires a running peer server with the expected data. Is an integration test in CI going to be too heavy?

The postgresql feature is also optional and I don't run this test in CI since babashka is only compiled with the default feature flags in CI. If your company is going to use the feature-flagged build of babashka, I recommend running the tests in your own CI. I do welcome an integration test. Maybe the new Datomic dev-local thing can be used for this? https://docs.datomic.com/cloud/dev-local.html See the postgresql tests for an example of integration tests that aren't run in CI but are run when you enable the feature flag.

Re: Does this require permission from the Datomic team? I feel it's a gray area because the jar asset is fully public in maven and doesn't require a license key, but of course we should honor the Datomic EULA.

What does this refer to?

bhurlow

comment created time in 2 days

Pull request review commentborkdude/babashka

Feature: Datomic Client

           ;; java.net.URL, see below           java.net.URLEncoder           java.net.URLDecoder+          ;;

All of these classes only need to be brought into the reflection config when the feature flag is enabled.

bhurlow

comment created time in 2 days

Pull request review commentborkdude/babashka

Feature: Datomic Client

+{

We manage resources dynamically in script/compile and script/compile.bat based on feature flags.

bhurlow

comment created time in 2 days

Pull request review commentborkdude/babashka

Feature: Datomic Client

+(ns client-test

This script probably needs to be implemented as a proper test. See the postgres tests how to execute a test based on a feature flag.

bhurlow

comment created time in 2 days

Pull request review commentborkdude/babashka

Feature: Datomic Client

                  [cheshire "5.10.0"]                  [fipp "0.6.22"]                  [nrepl/bencode "1.1.0"]-                 [borkdude/sci.impl.reflector "0.0.1-java11"]]+                 [borkdude/sci.impl.reflector "0.0.1-java11"]+                 [com.datomic/client-pro "0.9.57"]]

This dependency needs to be hidden behind a profile like :feature/datomic-client

bhurlow

comment created time in 2 days

issue commentborkdude/jet

Consider YAML

@iku000888 The reason was mostly that its now support in babashka.

borkdude

comment created time in 3 days

issue commentborkdude/sci

Add a flag to control execution length/time

An alternative to iterate-max could be an interrupt. E.g.:

(def interrupt-state (atom false))
(future (Thread/sleep 10000) (reset! interrupt-state true))
(sci/eval-string "(loop [] (recur))"  {:interrupt interrupt-state})

This takes forever, but after 10 seconds the interrupt-state is set to false which will make sci stop execution. Could also work in JS using setTimeout.

jeroenvandijk

comment created time in 6 days

issue closedborkdude/babashka

What is approx. compile time for bb using graal?

Thanks for making babashka. I think it is really awesome.

Sorry, if this is not the right place to ask this question, but what is the approx. compile time? I needed to compile with jdbc support and set the corresponding JDBC and postgres flags.

Here is the output. Are these kind of messages and compile times normal?

[bb:18327] classlist: 3,530.53 ms, 0.96 GB [bb:18327] (cap): 1,804.86 ms, 0.96 GB [bb:18327] setup: 3,331.98 ms, 0.96 GB [Use -Dgraal.LogFile=<path> to redirect Graal log output to a file.] [thread:28] scope: ForkJoinPool-4-worker-19 [thread:28] scope: ForkJoinPool-4-worker-19.registerResource ServiceLoaderFeature: registerResource: META-INF/services/java.nio.file.spi.FileSystemProvider [thread:28] scope: ForkJoinPool-4-worker-19.registerResource ServiceLoaderFeature: registerResource: META-INF/services/com.fasterxml.jackson.core.JsonFactory [thread:28] scope: ForkJoinPool-4-worker-19.registerResource ServiceLoaderFeature: registerResource: META-INF/services/java.sql.Driver [thread:28] scope: ForkJoinPool-4-worker-19.registerResource Resources have been added by ServiceLoaderFeature. Automatic registration can be disabled with -H:-UseServiceLoaderFeature Exception in thread "Libgraal MBean Registration" java.lang.OutOfMemoryError: GC overhead limit exceeded [bb:18327] analysis: 2,836,654.44 ms, 4.17 GB

I am new to the whole Graal thing, so maybe I am missing something. I do know that Graal compile times can be quite slow. but this is reaching ~45 minutes? And the activity monitor (doing this on mac osx) continuously showed the java process at 900-1000% of CPU.

The following is not related to my question, but just thought of letting you know in case it is something which needs to be fixed. I set the LEAN flag, to see if the compile was any faster - but got an exception.

➜ babashka git:(master) script/uberjar openjdk version "11.0.7" 2020-04-14 OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02) OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing) OpenJDK 64-Bit Server VM warning: forcing TieredStopAtLevel to full optimization because JVMCI is enabled OpenJDK 64-Bit Server VM warning: forcing TieredStopAtLevel to full optimization because JVMCI is enabled Syntax error (ClassNotFoundException) compiling at (/private/var/folders/zj/qb5ctrb51nbdwl47kqrn7yrr0000gn/T/form-init17339255376866517147.clj:1:126). org.yaml.snakeyaml.error.YAMLException

closed time in 6 days

samirsa

issue commentbabashka/babashka.nrepl

implement interrupt

I’ve already tried implementing this. The JVM uses Thread/stop for this, which has long been deprecated and not supported because of this on GraalVM.

On Tue, 7 Jul 2020 at 05:31, Crispin Wellington notifications@github.com wrote:

I'm beginning to need interrupt support. This one will be interesting...

https://github.com/clojure-emacs/cider/blob/dffe8c5c0bb6d07157e3db7322a0c8076ccb3a7b/cider-client.el#L387

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/babashka/babashka.nrepl/issues/23, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFSBVVBPHMMI5H43IL2EDR2KJHPANCNFSM4OSMEIUQ .

-- https://www.michielborkent.nl https://www.eetvoorjeleven.nu

retrogradeorbit

comment created time in 6 days

pull request commentborkdude/sci

Incorporate Slack discussions with borkdude into README

Thanks a lot!

lread

comment created time in 8 days

push eventborkdude/sci

Lee Read

commit sha 88bb9c542fd1d404fd3bb25eb556e86668ef30de

Incorporate Slack discussions with borkdude into README (#364) - Under "Usage" section, the reader is introduced to bindings. The println binding example might be interpreted as how one should use println with sci. Now mentioning that this simply an illustrative example. - Under "Vars" section, add a few of borkdude's Slack chat words on rationale for vars. - Under "Stdout and stdin" section, added an example of how an included Clojure function could map to sci's out. - Add a "Positional metadata" section - this confused me when I was experimenting with rewrite-cljc under sci.

view details

push time in 8 days

PR merged borkdude/sci

Incorporate Slack discussions with borkdude into README
  • Under "Usage" section, the reader is introduced to bindings. The println binding example might be interpreted as how one should use println with sci. Now mentioning that this simply an illustrative example.
  • Under "Vars" section, add a few of borkdude's Slack chat words on rationale for vars.
  • Under "Stdout and stdin" section, added an example of how an included Clojure function could map to sci's out.
  • Add a "Positional metadata" section - this confused me when I was experimenting with rewrite-cljc under sci.
+38 -5

1 comment

1 changed file

lread

pr closed time in 8 days

push eventborkdude/babashka

Michiel Borkent

commit sha 8e7d4d4bbfe8034e27eee4d9579095fcd1b78018

doc [skip ci]

view details

push time in 8 days

push eventborkdude/babashka

Michiel Borkent

commit sha f262e0b4dcdfa25fabd440a64a2f3bcfa77cfd3e

doc [skip ci]

view details

push time in 8 days

issue commentborkdude/babashka

What is approx. compile time for bb using graal?

@samirsa Fixed BABASHKA_LEAN with 227b8a0e7743e6074a89cc0ba6112a06c758b02a.

On my laptop OS, macOS Mojave, I'm getting 47MB for the lean build and 64MB for the normal build. In the past, when incorporating the Postgres driver, it added only 3MB or so, so that would be 67MB in total. Where do you get 100MB, that doesn't sound entirely right.

Maybe a small snippet in the readme, that building is not required for sql support would be helpful?

Yes, I'll add the snippet. Thanks for the feedback.

samirsa

comment created time in 8 days

push eventborkdude/babashka

Michiel Borkent

commit sha 227b8a0e7743e6074a89cc0ba6112a06c758b02a

Fix BABASHKA_LEAN

view details

push time in 8 days

issue commentborkdude/babashka

What is approx. compile time for bb using graal?

@samirsa Another tip btw, have you seen https://github.com/babashka/babashka-sql-pods? This doesn't require compilation, you can just install the pod and have postgres queries work that way.

samirsa

comment created time in 9 days

issue commentborkdude/babashka

What is approx. compile time for bb using graal?

@samirsa It should not be 45 minutes, more in the ballpark of 5-10 minutes. Have you tried setting the -Xmx value higher with BABASHKA_XMX=-J-Xmx7000m for example?

I'll look into the LEAN flag issue. Thanks for reporting.

samirsa

comment created time in 9 days

push eventborkdude/babashka

Michiel Borkent

commit sha 307b6dba0d8630e41da2fef5b94fd51c8c51b442

sci [skip ci]

view details

push time in 9 days

push eventborkdude/sci

Michiel Borkent

commit sha c7da47dd4e8296a62daf837606ffc7d3eba60962

Update sci channel

view details

push time in 9 days

issue closedborkdude/sci

metadata fn on defn f fails if calling defn f

version 0.1.1-alpha.2

platform macOS 10.15.5 Clojure 1.10.536 on JDK 11

symptom When metadata :test on (defn x) is a function and that function calls x, x cannot be resolved.

This use case occurs in test.check's defspec.

repro Here's my attempt at distilling the issue to a file we'll call metaeval.clj:

(defn ^{:test (fn []
                (println "hey there from af meta fn")
                (af))}
  af []
   (println "hi from af"))

(println "call af:")
(af)

(println "\ncall af :test fn:")
((:test (meta #'af)))

expected behavior If we run the above code through Clojure, all works as expected:

> clojure metaeval.clj
call af:
hi from af

call af :test fn:
hey there from af meta fn
hi from af

actual behaviour Running the same code through sci gives us:

> clojure -Sdeps '{:deps {borkdude/sci {:mvn/version "0.1.1-alpha.2"}}}' \
               --report stderr \
               -e "(require '[sci.core :as sci]) (sci/binding [sci/out *out*] (sci/eval-string (slurp \"metaeval.clj\")))"
{:clojure.main/message
 "Execution error (ExceptionInfo) at sci.impl.utils/throw-error-with-location (utils.cljc:54).\nCould not resolve symbol: af [at line 3, column 18]\n",
 :clojure.main/triage
 {:clojure.error/class clojure.lang.ExceptionInfo,
  :clojure.error/line 54,
  :clojure.error/cause
  "Could not resolve symbol: af [at line 3, column 18]",
  :clojure.error/symbol sci.impl.utils/throw-error-with-location,
  :clojure.error/source "utils.cljc",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.ExceptionInfo,
    :message "Could not resolve symbol: af [at line 3, column 18]",
    :data {:type :sci/error, :line 3, :column 18},
    :at
    [sci.impl.utils$throw_error_with_location
     invokeStatic
     "utils.cljc"
     54]}],
  :trace
  [[sci.impl.utils$throw_error_with_location
    invokeStatic
    "utils.cljc"
    54]
   [sci.impl.utils$throw_error_with_location invoke "utils.cljc" 44]
   [sci.impl.utils$throw_error_with_location
    invokeStatic
    "utils.cljc"
    45]
   [sci.impl.utils$throw_error_with_location invoke "utils.cljc" 44]
   [sci.impl.analyzer$resolve_symbol invokeStatic "analyzer.cljc" 137]
   [sci.impl.analyzer$resolve_symbol invoke "analyzer.cljc" 115]
   [sci.impl.analyzer$analyze_call invokeStatic "analyzer.cljc" 645]
   [sci.impl.analyzer$analyze_call invoke "analyzer.cljc" 637]
   [sci.impl.analyzer$analyze invokeStatic "analyzer.cljc" 748]
   [sci.impl.analyzer$analyze invoke "analyzer.cljc" 727]
   [sci.impl.analyzer$analyze_children$fn__905
    invoke
    "analyzer.cljc"
    146]
   [clojure.core$mapv$fn__8445 invoke "core.clj" 6912]
   [clojure.lang.PersistentList reduce "PersistentList.java" 144]
   [clojure.core$reduce invokeStatic "core.clj" 6827]
   [clojure.core$mapv invokeStatic "core.clj" 6903]
   [clojure.core$mapv invoke "core.clj" 6903]
   [sci.impl.analyzer$analyze_children
    invokeStatic
    "analyzer.cljc"
    146]
   [sci.impl.analyzer$analyze_children invoke "analyzer.cljc" 145]
   [sci.impl.analyzer$expand_fn_args_PLUS_body
    invokeStatic
    "analyzer.cljc"
    198]
   [sci.impl.analyzer$expand_fn_args_PLUS_body
    invoke
    "analyzer.cljc"
    166]
   [sci.impl.analyzer$expand_fn$fn__933 invoke "analyzer.cljc" 222]
   [clojure.lang.PersistentVector reduce "PersistentVector.java" 343]
   [clojure.core$reduce invokeStatic "core.clj" 6827]
   [clojure.core$reduce invoke "core.clj" 6810]
   [sci.impl.analyzer$expand_fn invokeStatic "analyzer.cljc" 219]
   [sci.impl.analyzer$expand_fn invoke "analyzer.cljc" 205]
   [sci.impl.analyzer$analyze_call invokeStatic "analyzer.cljc" 670]
   [sci.impl.analyzer$analyze_call invoke "analyzer.cljc" 637]
   [sci.impl.analyzer$analyze invokeStatic "analyzer.cljc" 748]
   [sci.impl.analyzer$analyze invoke "analyzer.cljc" 727]
   [sci.impl.analyzer$analyze_children$fn__905
    invoke
    "analyzer.cljc"
    146]
   [clojure.core$mapv$fn__8445 invoke "core.clj" 6912]
   [clojure.core.protocols$iter_reduce invokeStatic "protocols.clj" 49]
   [clojure.core.protocols$fn__8148 invokeStatic "protocols.clj" 75]
   [clojure.core.protocols$fn__8148 invoke "protocols.clj" 75]
   [clojure.core.protocols$fn__8088$G__8083__8101
    invoke
    "protocols.clj"
    13]
   [clojure.core$reduce invokeStatic "core.clj" 6828]
   [clojure.core$mapv invokeStatic "core.clj" 6903]
   [clojure.core$mapv invoke "core.clj" 6903]
   [sci.impl.analyzer$analyze_children
    invokeStatic
    "analyzer.cljc"
    146]
   [sci.impl.analyzer$analyze_children invoke "analyzer.cljc" 145]
   [sci.impl.analyzer$analyze invokeStatic "analyzer.cljc" 742]
   [sci.impl.analyzer$analyze invoke "analyzer.cljc" 727]
   [sci.impl.analyzer$expand_declare$fn__1037$fn__1038$fn__1039
    invoke
    "analyzer.cljc"
    477]
   [clojure.lang.ArrayChunk reduce "ArrayChunk.java" 58]
   [clojure.core.protocols$fn__8154 invokeStatic "protocols.clj" 136]
   [clojure.core.protocols$fn__8154 invoke "protocols.clj" 124]
   [clojure.core.protocols$fn__8114$G__8109__8123
    invoke
    "protocols.clj"
    19]
   [clojure.core.protocols$seq_reduce invokeStatic "protocols.clj" 31]
   [clojure.core.protocols$fn__8144 invokeStatic "protocols.clj" 75]
   [clojure.core.protocols$fn__8144 invoke "protocols.clj" 75]
   [clojure.core.protocols$fn__8088$G__8083__8101
    invoke
    "protocols.clj"
    13]
   [clojure.core$reduce invokeStatic "core.clj" 6828]
   [clojure.core$reduce invoke "core.clj" 6810]
   [sci.impl.analyzer$expand_declare$fn__1037$fn__1038
    invoke
    "analyzer.cljc"
    469]
   [clojure.lang.AFn applyToHelper "AFn.java" 154]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$update_in$up__6853 invoke "core.clj" 6185]
   [clojure.core$update_in$up__6853 invoke "core.clj" 6184]
   [clojure.core$update_in invokeStatic "core.clj" 6186]
   [clojure.core$update_in doInvoke "core.clj" 6172]
   [clojure.lang.RestFn invoke "RestFn.java" 445]
   [sci.impl.analyzer$expand_declare$fn__1037
    invoke
    "analyzer.cljc"
    467]
   [clojure.lang.Atom swap "Atom.java" 37]
   [clojure.core$swap_BANG_ invokeStatic "core.clj" 2352]
   [clojure.core$swap_BANG_ invoke "core.clj" 2345]
   [sci.impl.analyzer$expand_declare invokeStatic "analyzer.cljc" 464]
   [sci.impl.analyzer$expand_declare invoke "analyzer.cljc" 463]
   [sci.impl.analyzer$expand_defn invokeStatic "analyzer.cljc" 324]
   [sci.impl.analyzer$expand_defn invoke "analyzer.cljc" 321]
   [sci.impl.analyzer$analyze_call invokeStatic "analyzer.cljc" 673]
   [sci.impl.analyzer$analyze_call invoke "analyzer.cljc" 637]
   [sci.impl.analyzer$analyze invokeStatic "analyzer.cljc" 748]
   [sci.impl.analyzer$analyze invoke "analyzer.cljc" 727]
   [sci.impl.interpreter$eval_form invokeStatic "interpreter.cljc" 647]
   [sci.impl.interpreter$eval_form invoke "interpreter.cljc" 639]
   [sci.impl.interpreter$eval_string_STAR_
    invokeStatic
    "interpreter.cljc"
    659]
   [sci.impl.interpreter$eval_string_STAR_
    invoke
    "interpreter.cljc"
    653]
   [sci.impl.interpreter$eval_string
    invokeStatic
    "interpreter.cljc"
    668]
   [sci.impl.interpreter$eval_string invoke "interpreter.cljc" 664]
   [sci.core$eval_string invokeStatic "core.cljc" 179]
   [sci.core$eval_string invoke "core.cljc" 142]
   [sci.core$eval_string invokeStatic "core.cljc" 177]
   [sci.core$eval_string invoke "core.cljc" 142]
   [user$eval5158 invokeStatic "NO_SOURCE_FILE" 1]
   [user$eval5158 invoke "NO_SOURCE_FILE" 1]
   [clojure.lang.Compiler eval "Compiler.java" 7177]
   [clojure.lang.Compiler eval "Compiler.java" 7132]
   [clojure.core$eval invokeStatic "core.clj" 3214]
   [clojure.main$eval_opt invokeStatic "main.clj" 488]
   [clojure.main$eval_opt invoke "main.clj" 482]
   [clojure.main$initialize invokeStatic "main.clj" 508]
   [clojure.main$null_opt invokeStatic "main.clj" 542]
   [clojure.main$null_opt invoke "main.clj" 539]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause "Could not resolve symbol: af [at line 3, column 18]",
  :data {:type :sci/error, :line 3, :column 18}}}

Execution error (ExceptionInfo) at sci.impl.utils/throw-error-with-location (utils.cljc:54).
Could not resolve symbol: af [at line 3, column 18]

Notice that af could not be resolved within the meta :test function.

closed time in 9 days

lread

issue closedborkdude/meta

Help malli to make sci optional

See https://github.com/metosin/malli/issues/203

closed time in 9 days

borkdude

issue commentcognitect/transit-clj

Writing large object to file is slow

@strssndktn I worked around this by first writing to a ByteArrayOutputStream for which .flush is a no-op and that helped a lot.

borkdude

comment created time in 10 days

delete branch borkdude/clj-kondo

delete branch : issue-932

delete time in 10 days

push eventborkdude/clj-kondo

Michiel Borkent

commit sha 95e5a580897f5dfbcb36d7ffbd4d52244835af11

[#932] support ns meta config for unused binding linter

view details

push time in 10 days

create barnchborkdude/clj-kondo

branch : issue-932

created branch time in 10 days

issue commentborkdude/clj-kondo

unused-binding linter not observing namespace var metadata

@slimslenderslacks Any reason you're not just using underscores to get rid of the warnings?

(defn x [_x] (println "")
slimslenderslacks

comment created time in 10 days

push eventborkdude/babashka

Michiel Borkent

commit sha b05c36da35f32df2dad391d5b67be64cb99126c0

borkdude/sci#363

view details

push time in 10 days

push eventborkdude/sci

Michiel Borkent

commit sha 46f96afee7a94475289299bc34163c5eaa1c1413

[#363] metadata fn on var f fails if referring to f

view details

push time in 10 days

push eventborkdude/babashka

Michiel Borkent

commit sha 1ee07bb1c562bf624083222da67d858aac309bf8

borkdude/sci#361: eval metadata on var created with defn

view details

push time in 11 days

issue closedborkdude/sci

Metadata on defn is not evaluated

version recent pull from master, illustrations below are via bb v0.1.3

platform macOS 10.15.5 Clojure 1.10.536 on JDK 11 for Clojure examples

symptom While bringing in portions of test.check for an experimental project, I noticed that defspec was failing.

repro While trying to diagnose why defspec was failing noticed that the defspec macro is slightly different from clojure.test’s deftest in the way it attaches metadata.

defspec attaches metadata to a defn whereas deftest attaches metadata it to a def.

Here’s my attempt at distilling the difference to a snippit in a file we'll call metadefn.clj:

(require '[clojure.pprint :as pprint])

(println "metadata fn on def")
(def ^{:test (fn [] (println "hey there from a"))} a 1)
(pprint/pprint (meta #'a))
((:test (meta #'a)))

(println "\nmetadata fn on defn")
(defn ^{:test (fn [] (println "hey there from af"))} af [])
(pprint/pprint (meta #'af))
((:test (meta #'af)))

expected behavior If we run the above snippit through Clojure, we get:

> clojure metadefn.clj 
metadata fn on def
{:test #object[user$fn__140 0x29f0802c "user$fn__140@29f0802c"],
 :line 4,
 :column 1,
 :file "/Users/lee/proj/oss/play/metadefn.clj",
 :name a,
 :ns #object[clojure.lang.Namespace 0x29a23c3d "user"]}
hey there from a

metadata fn on defn
{:test #object[user$fn__148 0x1a411233 "user$fn__148@1a411233"],
 :arglists ([]),
 :line 9,
 :column 1,
 :file "/Users/lee/proj/oss/play/metadefn.clj",
 :name af,
 :ns #object[clojure.lang.Namespace 0x29a23c3d "user"]}
hey there from af

actual behavior Running the same snippit through sci (via babashka) gives us:

> bb metadefn.clj 
metadata fn on def
{:line 4,
 :column 6,
 :end-line 4,
 :end-column 53,
 :test #object[sci.impl.fns$parse_fn_args_PLUS_body$run_fn__12684
               "0x7473ea2e"
               "sci.impl.fns$parse_fn_args_PLUS_body$run_fn__12684@10f217700"],
 :name a,
 :ns #object[sci.impl.vars.SciNamespace "0x84a3722" "user"],
 :file "/Users/lee/proj/oss/play/metadefn.clj"}
hey there from a

metadata fn on defn
{:ns #object[sci.impl.vars.SciNamespace "0x84a3722" "user"],
 :name af,
 :file "/Users/lee/proj/oss/play/metadefn.clj",
 :end-column 60,
 :column 1,
 :line 9,
 :end-line 9,
 :arglists ([]),
 :test (fn [] (println "hey there from af"))}
java.lang.Exception: Cannot call (fn [] (println "hey there from af")) as a function. [at /Users/lee/proj/oss/play/metadefn.clj, line 11, column 1]

Notice for that the defn :test metadata was not evaluated whereas the def version was.

closed time in 11 days

lread

issue commentborkdude/sci

Metadata on defn is not evaluated

I butchered the issue number in the commit, but this fixed it:

e1274a8a3a2d370553d349d9f3206d572c709f6b

Releasing as 0.1.1-alpha.2

lread

comment created time in 11 days

push eventborkdude/sci

Michiel Borkent

commit sha 7454c54b1bd681ba6662d97dff1847aa41c1df0f

Bump version

view details

push time in 11 days

delete branch borkdude/sci

delete branch : issue-371

delete time in 11 days

push eventborkdude/sci

Michiel Borkent

commit sha e1274a8a3a2d370553d349d9f3206d572c709f6b

[#371] eval metadata on var created with defn

view details

push time in 11 days

PR merged borkdude/sci

[#371] eval metadata on var created with defn
+29 -14

0 comment

2 changed files

borkdude

pr closed time in 11 days

push eventborkdude/sci

Michiel Borkent

commit sha 9cf0f257a24777f6aa5c88ab6a35ef26458742fd

fix native

view details

push time in 11 days

push eventborkdude/sci

Michiel Borkent

commit sha 287451e14252b1fab00bfc20a24e5149eb97e3ff

Update README.md

view details

Michiel Borkent

commit sha c34c12fe9b825d473733b6880a452e4a05791ede

Merge branch 'master' into issue-371

view details

push time in 11 days

PR opened borkdude/sci

[#371] eval metadata on var created with defn
+28 -14

0 comment

2 changed files

pr created time in 11 days

push eventborkdude/sci

Michiel Borkent

commit sha 285513ebf38390501d1dc3baee9ed242c156514b

Clean

view details

push time in 11 days

push eventborkdude/sci

Michiel Borkent

commit sha 74636f0ecf876cde95ccb11dc1a1f39bee8afab8

Revert "Possible solution" This reverts commit 10e7fa4edbfa8fa0bb32d4b9e179b41938956ba0.

view details

Michiel Borkent

commit sha 37c831c5e6b4367068496e91f6b835a06366a4d2

Proper solution

view details

push time in 11 days

push eventborkdude/sci

Michiel Borkent

commit sha 10e7fa4edbfa8fa0bb32d4b9e179b41938956ba0

Possible solution

view details

push time in 11 days

create barnchborkdude/sci

branch : issue-371

created branch time in 11 days

issue commentbabashka/babashka.pods

clojars/maven like pull mechanism for pods

The hurdle with deftype is the implementation of interfaces. Bb is running an interpreter and cannot emit JVM bytecode like Clojure can to construct implementations of interfaces. So I guess deftype would fail in a lot of cases if we alias it to defrecord.

defrecord only works for implementing protocols at the moment.

zcaudate

comment created time in 11 days

issue commentbabashka/babashka.pods

clojars/maven like pull mechanism for pods

@zcaudate An option could be to use :bb reader conditionals and replace the deftype by defrecord or something else that is supported in babashka.

zcaudate

comment created time in 11 days

issue commentbabashka/babashka.pods

clojars/maven like pull mechanism for pods

@zcaudate deftype is not supported yet in SCI, the interpreter used by babashka. See https://github.com/borkdude/sci/issues/345. I don't expect this will be implemented soon.

zcaudate

comment created time in 11 days

issue commentbabashka/babashka.pods

clojars/maven like pull mechanism for pods

@zcaudate Got it. You should also add it to :imports in babashka.main.clj.

zcaudate

comment created time in 11 days

delete branch borkdude/clj-kondo

delete branch : issue-924

delete time in 11 days

push eventborkdude/clj-kondo

Michiel Borkent

commit sha b9c0fde6cbdc974840316c3b3f7abb49ac23d683

[#924] Configure unused-private-var via ns metadata

view details

push time in 11 days

push eventborkdude/clj-kondo

Ryan Schmukler

commit sha 961e04d3b20fefeac0c0b6f5cdb40252c7f75b5a

docs: note that JDK 8 based graal is required (#926) Makes a note that currently only JDK 11 based graal VMs are supported. Since many clojure devs aren't yet familiar with compiling native images it's nice to help them stay on a safe path that works.

view details

Michiel Borkent

commit sha 19bb627130c1f2cc81ffd65eeef0cfb447eb54f1

Clean up profiling code and document

view details

Michiel Borkent

commit sha ec8d72705bc9ed7d90a2cbf4262dbc461aca29dc

doc [skip ci]

view details

Timofey

commit sha a7a8d439d559b4cbfb98a00010fc8c3c3dfd98ab

add coc.nvim, coc-diagnostic setup instructions (#931)

view details

Michiel Borkent

commit sha 67f114a64befc20b7c03051ca4e9fc0b7f8a15da

Update README.md

view details

Michiel Borkent

commit sha 5c318addc34bbb8ed199f373f5e701848d3389bb

Update README.md

view details

Michiel Borkent

commit sha 065923c689ac918615f0dd0c50c04b633560a486

Merge branch 'master' into issue-924

view details

push time in 11 days

push eventborkdude/clj-kondo

Michiel Borkent

commit sha 79f68145348feee62f6346bb4ad82ea88ff97f44

wip

view details

push time in 11 days

issue commentbabashka/babashka.pods

clojars/maven like pull mechanism for pods

@zcaudate Here are some tips on getting started:

https://github.com/borkdude/babashka/blob/master/doc/dev.md

One thing to note: you need to clone with the --recursive option.

zcaudate

comment created time in 11 days

push eventlread/clj-graal-docs

Adrian

commit sha 21538631aa64e5741430e28d5055021ceb6d82ca

Added a section for writing GraalVM specific code. (#43) * Update Readme.md * updated clojure version in hello world example. * fixing typo. * Added a section for writing GraalVM specific code.

view details

push time in 12 days

push eventlread/clj-graal-docs

Nate Jones

commit sha c7e278ba6e71ff37dcfae048755ff8966ecb56fe

Add brisk and tabl, two utilities compiled with graalvm (#45)

view details

push time in 12 days

PR merged lread/clj-graal-docs

Add brisk and tabl, two utilities compiled with graalvm

Thanks for maintaining all this GraalVM information. It's extremely useful.

+2 -0

0 comment

1 changed file

justone

pr closed time in 12 days

PR merged borkdude/babashka

Add tabl to pod list
+1 -0

0 comment

1 changed file

justone

pr closed time in 12 days

push eventborkdude/babashka

Nate Jones

commit sha 640ebce2420133060924522c860c1514b3d6fd60

Add tabl to pod list (#503)

view details

push time in 12 days

startedjustone/tabl

started time in 12 days

issue closedborkdude/clj-reflector-graal-java11-fix

Version for latest GraalVM CE LTS release, 19.3.2?

Hi, thanks for making this!

The README says:

Use the right GraalVM version modifier: graalvm-19.3.1 or graalvm-20.0.0. The modifier must exactly match the version of GraalVM native-image.

I just downloaded GraalVM CE for my Mac and it looks like the latest CE LTS release is 19.3.2.

Do you have any plans to release a version of this library that works with 19.3.2?

Is this something I could help with?

Thanks!

closed time in 12 days

aviflax

issue commentborkdude/clj-reflector-graal-java11-fix

Version for latest GraalVM CE LTS release, 19.3.2?

@aviflax This issue should now be solved using the latest recommendations by @lread added to the README.

aviflax

comment created time in 12 days

pull request commentborkdude/clj-reflector-graal-java11-fix

Add tools deps usage notes to README

Thanks!

lread

comment created time in 12 days

PR merged borkdude/clj-reflector-graal-java11-fix

Add tools deps usage notes to README

This project depends on native dep org.graalvm.nativeimage/svm.

While technically correct, tools deps does not support native deps and fails for this native dep.

Since the native dep is provided by the Graal installation anyway, it can be safely excluded for tools deps.

+32 -8

2 comments

1 changed file

lread

pr closed time in 12 days

push eventborkdude/clj-reflector-graal-java11-fix

Lee Read

commit sha 6e6d5ac55e98c45b5dacc3fe6e617a8e094399a8

Add tools deps usage notes to README (#2) * Add tools deps usage notes to README This project depends on native dep org.graalvm.nativeimage/svm. While technically correct, tools deps does not support native deps and fails for this native dep. Since the native dep is provided by the Graal installation anyway, it can be safely excluded for tools deps. * Refine README Usage Section Add in rationale for native dep exclusion for tools deps. With this extra text, for clarity, reorganized usage into subsections.

view details

push time in 12 days

pull request commentborkdude/clj-reflector-graal-java11-fix

Add tools deps usage notes to README

Can you add the comment you made in this issue to the README as well? That seems pretty informative.

lread

comment created time in 12 days

issue commentborkdude/sci

optimize build size by letting users choose core function(s)(ality)

I think the option to programmatically create the namespaces.cljc file (to limit access to core vars) is an interesting one. What would happen btw if you right now would include sci.impl.namespaces.cljc in your own project and just edited, ripped out the vars you don't need? I guess that would already work as of now

borkdude

comment created time in 12 days

push eventborkdude/babashka

Michiel Borkent

commit sha 018e011ee6f52e741d0fea424bbfdbfb24fbea47

Update ls_jar.clj [skip ci]

view details

push time in 12 days

issue commentbabashka/babashka.pods

clojars/maven like pull mechanism for pods

@zcaudate I think it would be good if you could get a picture of all the missing classes and other items that are needed to make your library work with babashka. You can do that with a local checkout of babashka and then use clojure -A:main -e "(require '[hara.log :as log])" to run it, instead of the binary. If classes are missing, you can add them locally to babashka.impl.classes and then run again, until it works. If it's only a handful of things, it might be good to support them in babashka. If it requires drastic changes to babashka, pod might be a good alternative.

zcaudate

comment created time in 12 days

push eventborkdude/sci

Michiel Borkent

commit sha 287451e14252b1fab00bfc20a24e5149eb97e3ff

Update README.md

view details

push time in 12 days

issue commentborkdude/dynaload

locking2

Btw, locking2 comes directly from clojure.spec.alpha so it's been already explain in the sense that all code in this library is directly extracted mostly as is from spec.

pithyless

comment created time in 12 days

issue commentborkdude/babashka

What companies are using babashka and/or sci? (at least one person at a company counts!)

Thanks for sharing you all!

To quote the tweet of @JduPreez:

@borkdude's Small Clojure Interpreter enabled Lifecheq to add scripting to our tools. Now the whole business is learning #Clojure & everyone's scripting their own solutions. This frees up a lot of time from the dev team. Pretty cool if you ask me

Screenshot 2020-07-01 12 44 03

Business people writing Clojure, that IS pretty cool.

borkdude

comment created time in 12 days

issue commentborkdude/dynaload

locking2

PR welcome. That macro indeed takes care of an issue with GraalVM for older Clojure versions.

pithyless

comment created time in 12 days

push eventborkdude/dynaload

Michiel Borkent

commit sha 0dfd3c2ee6c498286663f5cbf44a906082c7beba

Update README.md

view details

push time in 13 days

issue commentmetosin/malli

Make SCI dependency optional for smaller JS builds

I have closed the PR. Instead, I'm offering you this library https://github.com/borkdude/dynaload. If you need any help, let me know. :)

Naomarik

comment created time in 13 days

PR closed metosin/malli

[#203] make sci optional for smaller JS builds

This PR makes sci optional using the same mechanisms that clojure.spec uses to dynamically load test.check. Fixes #203.

  • [ ] Maybe split the dynaload code out into a library so it can be used from other projects as well. With copyright notice for code borrowed from spec.
  • [ ] Same mechanism can be used to make test.check optional for even smaller builds.
  • [ ] The tests do pass but due to randomization in kaocha they sometimes fail. The reason is that sci.core has to be required first. There's probably a kaocha preloads plugin which can do this. But the tests have to be adapted to the optionality of sci anyway.

Note that sci users now have to bring in the sci dependency themselves. If they don't they will get an error message when using malli.core/eval.

$ plk -A:sci
ClojureScript 1.10.597
cljs.user=> (require '[malli.core :as m])
nil
cljs.user=> (require '[sci.core])
nil
cljs.user=> (m/validate int? "1")
false
cljs.user=>
undefined is not an object (evaluating 'malli.core.eval_string.call')
cljs.user=> (m/eval "(+ 1 2 3)")
6

vs.

$ plk
ClojureScript 1.10.597
cljs.user=> (require '[malli.core :as m])
nil
cljs.user=> (m/validate int? "1")
false
cljs.user=> (m/eval "(+ 1 2 3)")
Execution error (Error) at (<cljs repl>:1).
Var sci.core/eval-string does not exist, sci.core never required
+78 -12

0 comment

7 changed files

borkdude

pr closed time in 13 days

push eventborkdude/dynaload

Michiel Borkent

commit sha c9ed0e253194d9a3d0c3d92351e76a4bbff8cbd3

doc

view details

push time in 13 days

push eventborkdude/dynaload

Michiel Borkent

commit sha 9d18160777f828fc7e3d229f335bb2cd68596eda

doc

view details

push time in 13 days

create barnchborkdude/dynaload

branch : master

created branch time in 13 days

created repositoryborkdude/dynaload

The dynaload logic from clojure.spec.alpha as a library

created time in 13 days

issue commentmetosin/malli

Make SCI dependency optional for smaller JS builds

Work in progress at #210. It works, but the tests need to be refactored to account for the optionality of sci.

Naomarik

comment created time in 13 days

PR opened metosin/malli

[#203] make sci optional for smaller JS builds
+78 -12

0 comment

7 changed files

pr created time in 13 days

create barnchborkdude/malli

branch : sci-optional

created branch time in 13 days

fork borkdude/malli

Plain data Schemas for Clojure/Script.

fork in 13 days

more