This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-16
Channels
- # aleph (4)
- # bangalore-clj (10)
- # beginners (39)
- # boot (24)
- # cljs-dev (66)
- # cljsrn (79)
- # clojure (39)
- # clojure-italy (7)
- # clojure-russia (6)
- # clojure-spec (4)
- # clojure-uk (1)
- # clojurescript (91)
- # core-async (1)
- # core-typed (2)
- # datomic (49)
- # hoplon (42)
- # lumo (2)
- # nyc (1)
- # off-topic (1)
- # parinfer (20)
- # pedestal (2)
- # reagent (4)
- # rum (14)
- # vim (2)
@alandipert so https://github.com/dm3/javelin/tree/macros-split-clj now has a Clojure implementation based on Plumbata. It passes all of the tests. Javelin also passes all of the tests in self-host Clojurescript mode. However I can’t figure out how to make it work under normal JVM Clojurescript! 🙂 The only significant change was splitting macros out into a separate namespace. I think the macros can be returned into javelin.core
but I’d like to figure out JVM Clojurescript first…
@flyboarder that’s not the problem. The code works as intended under self-host. The problem is when compiling javelin.macros
- due to the way the Clojurescript is compiled it chooses the wrong hoisting code-walking implementation when compiling JVM Clojurescript and I can’t figure out how to do it properly.
where is it loading the code from for the incorrect walk?
https://github.com/dm3/javelin/blob/macros-split-clj/src/javelin/macros.cljc#L3 at least that’s what I think is happening
you are using cljc files, so this will effect macro expansion will it not?
yes, so this macros.cljc
file when compiled for JVM Clojure uses javelin.macros.clj
ns for the hoist
function
my understanding was that with cljc files you use reader conditionals inside your macro to change what happens during clj/cljs builds
when compiled by self-host cljs it uses javelin.macros.js
for that same function - as specified in the (:require)
of the ns
the problem is that when compiling for the non self-host Clojurescript, the javelin.macros.clj
is loaded
at least that’s what I think is happening. I really should have looked into the JVM Clojurescript compiled output
right so inside the macro’s within javelin.macros.clj the macro should determine what to do for clj/cljs
right but there should be some overlap within javelin.macros
hmmmm
javelin.macros have no reader conditionals right now
other than the namespace
which doesnt help during runtime as per my understanding
ah ok yes I see
I want to use clojure.core/destructure
. I can use it in JVM Clojure. However, in JVM Clojurescript I need cljs.core/destructure
and in self-hosted I need cljs.core$macros/destructure
so wouldnt it be the same for self-hosted and cljs?
i thought the compiler sorted that out
also note line 55 - you have to be careful when using reader conditionals inside macros as you need to think of what you’re targeting instead of where you are being compiled
right macros in cljc files each macro should have a condition for clj/cljs unless it can be used for both
@dm3 do you have a sample project you are building with?
:thumbsup: