This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-17
Channels
- # admin-announcements (1)
- # boot (24)
- # cider (8)
- # cljsjs (1)
- # cljsrn (5)
- # clojure (22)
- # clojure-greece (1)
- # clojure-italy (3)
- # clojure-russia (218)
- # clojure-spec (33)
- # clojurescript (51)
- # core-async (6)
- # cursive (1)
- # datomic (13)
- # defnpodcast (2)
- # funcool (2)
- # lein-figwheel (21)
- # onyx (41)
- # proto-repl (4)
- # protorepl (5)
- # reagent (4)
has anyone experienced node is not a child
exception only when :advanced
optimizations?
@ajchemist: that error is deep in Closure Compiler so unlikely
might want to figure out what the reproducer is - I suspect probably nothing to do with ClojureScript though and it will probably need to be reported to the Closure Compiler mailing list
@ajchemist: That has evidently been reported previously in some unclarified context (see https://github.com/google/closure-compiler/issues/1339#issuecomment-167011814)
I'm not sure but It seems that the codes in binaryage/chromex
trigger node is not a child
exception in some place.
I have some data created by a macro that I want to use in CLJS without it being evaluated — How can I quote the return value of a macro?
macros are expanded by compiler going outside-in, so if your macro generates code which contains macros, they will get expanded on the way down
right that makes sense, it was just the only way I could figure out that would give me the result of the macro as data
@darwin: no particular reason for that (I guess I added it because when looking at the output it's visually easier to parse forms that are in a vector vs in a list)
@darwin: the issue is I want to evaluate these html-simplified calls and get the returned forms as data
or you can implement html-simplified*
as a normal function and call it from within compile-mult
this won’t prevent you from wraping html-simplified*
in html-simplified
macro if you still want to expose it as macro to cljs
@darwin: I just experimented with eval
a bit but maybe this is better. I'll chew on it a bit, thanks so much for your guidance!
When I have a (def thing [:some :data])
that I want to pass to a macro, can I do that from a cljs file? Just referencing thing
passes the symbol which isn't what I want
a macro rewrites code into other code during compile-time, if you write code which calls the macro with a symbol thing
, it sees just the symbol and cannot look what it maps to
also defs mappings can be manipulated at runtime, this in-principle cannot be solved by macros
Ok I kind of expected that to be the answer 😅
With that in mind, how can I read and edn file and pass it's value to a macro as if I'd write that data out, passing it to the macro directly?
@darwin: right that's what I'm doing right now but I need to pass the same data to multiple macros so it becomes a bit annoying
there is one trick you could do, cljs compiler exposes analyzer datastructures, you can work with them in macros
I just realized I can just make a bigger macro, lol
so in this particular case, you should be able to walk defs and “resolve” the mapping in your macro
Regarding the edn thing I was thinking of reading that during compile time so that seems like an equally OK approach?
ad edn reading, I’m sorry I cannot really tell which approach is better without seeing bigger picture, sorry
also when inlining external data into your cljs sources, please pay attention to source-code size implications
thanks, in this case I don't care about size as it's just some experiment 🙂
I wen't with the bigger macro all working now
Your earlier snippet also helped me a lot, so thanks for that again 🙂
btw. I had to learn deeper macro stuff when writing chromex, it was a nice exercise which forced me to really learn beyond simple oneliners: https://github.com/binaryage/chromex/blob/master/src/lib/chromex/wrapgen.clj
FYI today I learned really neat trick, for new cljs-devtools I’m writing a renderer from hiccup-like data structure into json-ml, and it has somewhat circular nature, so I have to maintain a map of all available hiccup “tags”, today I discovered a way how generate the map via a macro by walking analyzer’s defs data structure, the trick is this line: https://github.com/binaryage/cljs-devtools/commit/9a64e34330ba597b32de035d4299e17b6102f8cd#diff-69e303bb2f588f5ef48b209d7fa7da6fR7
@darwin that's totally wizard 😄 nice
when I was working for LambdaX btw I added an AST layer in replumb for common compiler state inspection, this is the mandatory link (sorry not spamming myself, just genuinly trying to share knowledge): http://lambdax.io/blog/posts/2016-03-22-replumb-ast.html
it is pretty neat that anytime you can peak at compiler data, it was like prying into the secret life of it (him? her? 😄)