This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-15
Channels
- # announcements (10)
- # beginners (113)
- # calva (2)
- # cider (75)
- # clj-kondo (1)
- # cljdoc (2)
- # clojure (142)
- # clojure-europe (11)
- # clojure-gamedev (6)
- # clojure-italy (7)
- # clojure-nl (8)
- # clojure-spec (3)
- # clojure-uk (50)
- # clojurescript (47)
- # cursive (7)
- # data-science (22)
- # datomic (12)
- # dirac (3)
- # events (1)
- # fulcro (114)
- # gorilla (1)
- # jackdaw (5)
- # joker (3)
- # kaocha (10)
- # leiningen (1)
- # liberator (2)
- # mount (6)
- # nrepl (1)
- # off-topic (16)
- # pathom (34)
- # pedestal (3)
- # re-frame (19)
- # reagent (11)
- # remote-jobs (5)
- # shadow-cljs (127)
- # spacemacs (12)
- # test-check (15)
- # tools-deps (8)
- # vim (4)
Hi Sean
Did my post make sense?
Trying to write some cross-platform macros...
Is there a more solid alternative to (find-ns 'cljs.analyzer)
as per https://stackoverflow.com/a/42209528/569050 ?
In principle it works, but for larger projects cljsbuild will fail because the conditional will return the wrong thing I believe
Unless you're using self-hosted ClojureScript macros will be evaluated as Clojure whether you're targeting the JVM or JavaScript, which is fine.
> for larger projects cljsbuild will fail because the conditional will return the wrong thing I believe What do you mean?
> Most macros you write will have that property. not sure. If I need to emit x or y depending on the consumer's platform, I need a hack such as the linked one in Stackoverflow. I found this pattern https://github.com/jeaye/orchestra/blob/4e7fd20ab6596528560c730d1425a77edc1ea2e9/src/cljc/orchestra/core.cljc#L21 which solved my issue
If you need the runtime behavior to be different depending on the host language why not macroexpand to a function call. You can then make the implementation of that function platform-dependent in one of the usual ways.
Again, if you need the runtime behavior to differ depending on the host language you could have your macro expand to a function call where the function being called has both a Clojure and a ClojureScript implementation.
Yes. More or less I did that: grab (-> &env :ns some?)
in the macro and pass that value as an argument to functions that are invoked from the macro
Just define a function that wraps the platform-specific behavior and have your macro expand to a call to that function.
Like so: http://bit.ly/2KHoS06
I'll try it thanks!
It might get muddier though for things that actually need a macro, and/or per-platform ns variations (`clojure.spec.alpha` vs cljs.spec.alpha
).
I'll have to see.
Yeah, I'd be interested to see a situation where this breaks down, but I'm having trouble imagining one.
Note that there's no reason why function
couldn't be defined in a namespace that has two completely different implementations, one .clj
and one .cljs
.
yeah, think it might be convenient to apply fingerprinting to both. Or maybe append the same sha’s to the source maps.
Is there a way to convert Google Closure annotations (e.g. in externs) into a more readable format like JSON or EDN?
I'm running lumo in a Win 10 cmd window. Anyone else experiencing the repl randomly quitting? Ex, (def pq #queue [1 2 3]), 50/50 chance it kicks out to command prompt. Using lumo 1.9.0, ClojureScript 1.10.439, Node.js v10.9.0.
Thanks. Can't generate problem with Lumo 1.10.1.
Please thread this… Does anyone have any thoughts on Deno’s impact on Clojurescript? How Deno uses html script includes to include JS libraries?
The creator of node js left around 2012 and went to create Deno
It still uses the V8 but also is written in Rust
I am wondering if the use of Deno will impact whether Clojurescript uses npm and node js, because JS keeps forking into different projects
I think Clojurescript is good because it can adapt to the JS stuff as JS keeps changing
yea, exactly
Vert.x is using Rhino and Nashorn runtime machines… so Clojurescript can adapt to anything
my theory is Google pushed some of these ideas with V8 and Golang, to get around using the JVM
because of the lawsuits between Oracle and Google for the past 10 years or so
Has anyone that uses Oz (https://github.com/metasoarous/oz) and shadow-cljs had issued with vegaTooltip not having the function vega
?