Clojurians
# dunaj

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

micha 03:35:49

wagjo: i'd like to get dunaj support in boot

wagjo 10:16:52

micha: OK, will look into it

micha 15:02:55

wagjo: if you could explain the relationship between clojure and dunaj from the classloader perspective, and the dunaj bootstrapping process

micha 15:03:15

that's the information i need to get boot support working

micha 15:11:51

does clojure.RT work the same in dunaj?

wagjo 17:15:24

micha: dunaj lite is just a library so you load it as any other library

wagjo 17:16:32

regular dunaj uses custom patched clojure, so I don't know how hard is in boot to remove clojure from dependency tree. In lein I have to explicitly exclude clojure for most of deps...

wagjo 17:17:15

Regarding bootstrapping, Dunaj first loads a small bootstrapping namespace that introduces enhancements to protocols, deftypes, and
provides defXXX macros that support type signatures.
Then I gradually introduce more and more features, starting with boolean, host primitives, math facilities ..., while trying to use already implemented Dunaj's features as soon as possible. There were of course some issues with cyclic dependency, toughest one was with core.async.
Also dynamic vars cannot be aliased so this was a bit of a pain too.
The order in which I've implemented stuff can be seen in a namespaces tab at https://docs.google.com/spreadsheets/d/1J8ndX6C1fuXGdIeekOWsmiqS2tmVb_OMZRKs3SphGPA/pubhtml#

wagjo 17:17:57

@wagjo shared a file: Dunaj summary tables

wagjo 17:20:50

clojure.RT was slightly patched to use Dunaj's collection protocols for seq, get and nth. Otherwise its the same.

wagjo 20:12:56

micha: yeah one thing that may cause issues in boot. Do not assume some var is referred in namespace you are evaling. always fully qualify symbols/vars if you are evaling them in project's namespace, even stuff from clojure.core.

micha 20:33:15

wagjo: thanks for the explanation! I think that's a good start for my experimentation with dunaj+boot. It's good that RT is more or less compatible because that's something that boot itself uses for its own bootstrapping. I'm hoping to be able to first simply create dunaj pods in boot in which a dunaj repl server can be started. From there we can explore how to fully integrate dunaj, if possible

wagjo 20:35:18

micha: I'm just learning how boot works and what it provides, so I can't help you with details much

micha 20:35:54

no worries, i was just a little overwhelmed trying to wrap my head around dunaj bootstrapping

micha 20:36:05

i think i should be on the right track now :simple_smile:

wagjo 20:37:03

great!

micha 20:38:02

is it correct to say that in a full dunaj environment i can use regular clojure libraries? or are there limitations like maybe libraries that depend on access to clojure's java implementation won't necessarily work?

wagjo 20:42:54

I tried hard to make Dunaj 'backwards' compatible. Most Clojure libraries should work. I'm using it with datomic, ring and friends without problem

micha 20:45:03

great!

micha 20:45:13

boot can help out there by providing pods

micha 20:45:34

i can imagine using clojure pods from a dunaj application

wagjo 20:46:01

Dunaj has its own fork of core.async so this dependency has to be excluded from others libraries you are using together with Dunaj

wagjo 20:47:43

One more thing, I don't know if it is of any importance, but Dunaj is AOTed before packed into .jar.

wagjo 20:48:26

as it is >40kloc of clojure code, nonAOTed loading took some time :simple_smile:

micha 20:50:05

interesting!

micha 20:50:27

i think that should work fine for what i will try to do

micha 20:51:04

does dunaj provide benefits in terms of decreased startup time?

micha 20:51:08

vs clojure?

wagjo 20:53:25

no, you have to load clojure and dunaj too, so its actually slower. It was not my goal to lower the startup time, as I wanted it to be backwards compatible...

micha 20:53:50

i see, yes