Differences from Clojure
jank is meant to be Clojure, but Clojure itself has no specification. There are differences between Clojure JVM, ClojureScript, Clojure CLR, ClojureDart, and others. Part of being a Clojure is embracing one’s host and being transparent about it. This is where most of the differences come into play.
jank does not try to hide its C++ host. That would defeat the point of being Clojure.
Command line
- You will find no Clojure CLI
-X:foosyntax here - When using
jank runorjank run-main,--is needed to separate args for jank from args for your program- Example:
jank -I include run test.jank -- a b c
- Example:
clojure.core
- Baked into the
jankbinary, not shipped separately - No nested
requiresupport (same as ClojureScript) - No
import (hash-map)returns a hash map, not an array mapagetis a special formasetis a macrokeywordis more strict about valid inputs
Object model
- No stable boxes for small integers (the JVM pre-allocates
1,2,3, etc) persistent_stringis expected to be UTF-8- No inheritance (currently)
- No records (yet)
- No protocols (yet)
- Sequences
- Support for in-place operations (
fresh-seq,next-in-place)
- Support for in-place operations (
Compilation model
- Source-only distribution
.ofiles found in JARs will not be used- Git deps are an exception here; if someone commits a .o file into a git dep on your module path, jank will load it
- jank uses the term “module path” instead of “class path”
- We don’t have
.classfiles - A module is backed by either a
.jank,.cljcor.cppsource file, optionally with a.ofile cached for quick loading
- We don’t have
Math
- Division by integer
0is undefined behavior - Division by floating point
0.0is well defined