replikativ / hitchhiker-tree

Functional, persistent, off-heap, high performance data structure
Eclipse Public License 1.0
44 stars 19 forks source link

Clojurescript tests pass for the konserve memory store #17

Closed groundedsage closed 3 years ago

groundedsage commented 3 years ago

simple-konserve-test and the manual-mixed-op-seq pass in cljs when the dynamic var for if-async? is set to true. Cljs tests are ran with shadow-cljs watch browser-test and shadow-cljs compile node-test. Clj tests are run with bin/kaocha. Clj works well with the dynamic var set to true or false.

Currently uses a branch where I updated konserve in-memory store support for cljs as a dependency.

When the dynamic var is set to false it causes complications during macro expansion which causes the cljs tests to not run.

groundedsage commented 3 years ago

Both the clj and cljs tests pass now with the same codebase.

It is not possible to use a cross-platform macro that is used within another cross-platform macro in the same namespace because macros always expand in clj first. The first macro can use (:ns &env) fine but the second will not.

Possible solutions available were:

  1. Append the macros with -cljs then :require-macros .. :refer .. :rename {foo-cljs foo} this is always needed in the ns requires and could be confusing to contributors
  2. Create separate namespaces that explicitly specifies the cljs variant of the macro then require the separate namespace. Which provides the option to auto-alias to the cljs namespace with a single require. Reference commit: https://github.com/clojure/clojurescript/commit/23632baa35f86de8866dede624545bc0cdf4a2bb

I have opted for the second. This does create quite a lot of duplication. So in the future, it may be preferable to change to option 1 when this library is considered done

whilo commented 3 years ago

There is still the joda-time js stuff in there, which we do not need, I think.