babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
2020-08-28T05:08:42.123200Z

@borkdude Thank you so much!

2020-08-28T10:41:36.126200Z

This may be my naivety about Graalvm, but how can bb have included java.time.Duration for example, (which imports DateTimeParseException), but DateTimeParseException itself is not included in such a way that we can import it?

borkdude 2020-08-28T11:04:53.127600Z

@henryw374 all classes are manually mapped into the interpreter. See babashka.impl.classes

2020-08-28T11:13:02.128100Z

I think itโ€™s a good question. If I understand your question correctly it is: โ€œhow come I cannot catch an exception that should be there based upon the imports of declared classes?โ€ My guess is that the uses of these classes are compiled into the minimum amount of byte code. So the outcome is not the original class anymore i.e. you cannot catch the exception of that class anymore. Anyway, Iโ€™m not sure about the details. Also guessing here

2020-08-28T11:15:12.129500Z

ok I see. thanks. I see it is still not all the classes from java.time. would there be any objection to having them all?

2020-08-28T11:16:48.129700Z

not saying I need any more... at some point I will try getting Tick or http://clojure.to work and it's possible there are others they refer to.

2020-08-28T11:18:11.129900Z

I think binary size and compilation time are considerations for adding classes. Indirect overhead is keeping track of the administratoin of what class does what and why to keep it.

2020-08-28T11:18:37.130100Z

yeah I guess it's something like that . FYI`(java.time.Duration/parse "sdf")` prints java.time.format.DateTimeParseException: Text cannot be parsed to a Duration [at line 10, column 1]

2020-08-28T11:19:28.130300Z

but as borkdude says to be imported the class must be manually mapped

๐Ÿ‘ 1
borkdude 2020-08-28T11:58:01.132Z

Yes. PRs with explanation of why the class is needed welcome.

borkdude 2020-08-28T12:09:22.134700Z

Maybe a script that shows whatโ€™s missing and/or a PR that adds those helps determining if adding them all is just a small increase

2020-08-28T12:15:15.134900Z

Sounds useful. I'll put a note in the tick ticket about it

borkdude 2020-08-28T12:22:49.136500Z

Btw I noticed that cljc.java-time is loading macrovich. Maybe that dep can be skipped for bb since itโ€™s not needed for anything probably. It does work.

borkdude 2020-08-28T12:23:23.137300Z

But loading that code does take a little bit of the startup that can be optimized maybe

borkdude 2020-08-28T12:24:38.138100Z

Or maybe itโ€™s peanuts and not important, just something I noticed

2020-08-28T13:15:43.138300Z

ah interesting. it's a long story about why it was needed originally. It could now be avoided if cljc.java-time creates .clj and .cljs files instead of .cljc ones. I was planning to do that at some point anyway for other reasons

borkdude 2020-08-28T19:03:14.138600Z

Babashka v0.2.0 is out! ๐ŸŽ‰ New features: uberjar, better error messages (context, locals, stack trace), support for clojure.datafy and more! Release notes: https://github.com/borkdude/babashka/blob/master/CHANGELOG.md#v020-2020-08-28

8
โค๏ธ 3
๐ŸŽ‰ 4
djblue 2020-08-28T20:04:35.142600Z

To play with the new clojure.datafy support in the 0.2.0 release, you can use portal: > bb -cp clj -Spath -Sdeps '{:deps {djblue/portal {:mvn/version "0.4.0"}}}'

๐Ÿ‘Œ 1
djblue 2020-08-28T20:05:20.143100Z

Thanks for all the hard work you've put into babashka @borkdude!

โค๏ธ 1
djblue 2020-08-28T20:06:57.143200Z

https://github.com/djblue/portal#api-usage

borkdude 2020-08-28T20:10:39.143500Z

Wow, what kind of magic is this!

djblue 2020-08-28T20:12:50.143700Z

The kind that clojure and it's awesome community makes possible! ๐Ÿ˜„

borkdude 2020-08-28T20:13:13.143900Z

Even the viewer works in babashka :)

djblue 2020-08-28T20:15:14.144100Z

I had to roll my own http server implementation but https://gist.github.com/borkdude/dca50a3d5a48ac6ab2ef6aa58a4e9f6b made it super easy to do

borkdude 2020-08-28T20:15:30.144300Z

:)

borkdude 2020-08-28T20:15:40.144500Z

I'm impressed!

1
borkdude 2020-08-28T20:18:08.144800Z

Added it to the changelogs

djblue 2020-08-28T20:18:50.145Z

Sweet, thanks!

djblue 2020-08-28T20:52:14.145600Z

I did ran into this bug in babashka https://github.com/djblue/portal/issues/11 caused by transit-clj ๐Ÿ˜ฌ

djblue 2020-08-28T20:52:57.145900Z

It exists on the jvm, but it's much easier to run into in babashka because I think it uses metadata more liberally

borkdude 2020-08-28T20:53:19.146100Z

True. Sci saves location information on them

borkdude 2020-08-28T20:54:02.146400Z

You might want to workaround it by just stripping the metadata before transitizing it?

djblue 2020-08-28T20:54:40.146600Z

The issue with that is the sometimes the metadata is put there by users implementing protocols

borkdude 2020-08-28T20:55:25.146900Z

I think you can just strip :line and :column, etc then.

user=> (meta 'x)
{:line 1, :column 7, :end-line 1, :end-column 9}

borkdude 2020-08-28T20:56:00.147200Z

Of course it's better to not have to work around it

๐Ÿ’ฏ 1
borkdude 2020-08-28T21:09:09.148200Z

Example of new error reporting in 0.2.0. You can even see the &env and &form locals on error during macro-expansion now:

๐Ÿš€ 3