Fork me on GitHub
#clojurescript
<
2019-04-15
>
Tangible Dream00:04:06

Did my post make sense?

vemv00:04:16

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

zane03:04:07

When you say "write some cross-platform macros" what do you mean?

zane03:04:16

What is the problem you're trying to solve?

vemv03:04:53

macros that can be consumed from both clj and cljs codebases

zane04:04:46

Most macros you write will have that property.

zane04:04:18

Unless you're using self-hosted ClojureScript macros will be evaluated as Clojure whether you're targeting the JVM or JavaScript, which is fine.

zane04:04:50

> for larger projects cljsbuild will fail because the conditional will return the wrong thing I believe What do you mean?

vemv04:04:57

> 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

zane04:04:44

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.

vemv04:04:33

Just to be clear: are you questioning the need for a cross-platform macro?

zane04:04:09

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.

vemv04:04:04

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

zane04:04:23

You don't need that hack.

zane04:04:16

Just define a function that wraps the platform-specific behavior and have your macro expand to a call to that function.

4
zane05:04:53

Note that example.macros/function's behavior differs depending on the runtime platform.

vemv05:04:17

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.

zane05:04:19

Yeah, I'd be interested to see a situation where this breaks down, but I'm having trouble imagining one.

zane05:04:27

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.

mkvlr10:04:46

is it correct that cljs fingerprinting doens’t fingerprint source maps?

dnolen12:04:51

pretty sure we don't do that

dnolen12:04:16

but not for any particular reason

mkvlr13:04:21

yeah, think it might be convenient to apply fingerprinting to both. Or maybe append the same sha’s to the source maps.

borkdude14:04:12

Is there a way to convert Google Closure annotations (e.g. in externs) into a more readable format like JSON or EDN?

steveh201814:04:06

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.

borkdude14:04:38

fwiw there’s a new version of lumo

steveh201814:04:59

Thanks. Can't generate problem with Lumo 1.10.1.

hipster coder19:04:58

Please thread this… Does anyone have any thoughts on Deno’s impact on Clojurescript? How Deno uses html script includes to include JS libraries?

hipster coder19:04:52

The creator of node js left around 2012 and went to create Deno

hipster coder19:04:07

It still uses the V8 but also is written in Rust

hipster coder19:04:28

I am wondering if the use of Deno will impact whether Clojurescript uses npm and node js, because JS keeps forking into different projects

hipster coder20:04:58

I think Clojurescript is good because it can adapt to the JS stuff as JS keeps changing

didibus20:04:04

ClojureScript isn't restricted to a single JS runtime

hipster coder20:04:45

Vert.x is using Rhino and Nashorn runtime machines… so Clojurescript can adapt to anything

didibus20:04:01

But if Deno stays unpopular, you probably won't see a lot of cljs tooling around it

hipster coder20:04:48

my theory is Google pushed some of these ideas with V8 and Golang, to get around using the JVM

hipster coder20:04:06

because of the lawsuits between Oracle and Google for the past 10 years or so

didibus05:04:14

But NodeJS doesn't use the JVM. So what would be the problem of it over Deno?

didibus19:04:35

What's Deno ?

Mno22:04:05

Has anyone that uses Oz (https://github.com/metasoarous/oz) and shadow-cljs had issued with vegaTooltip not having the function vega?

Mno22:04:37

I’ve been looking into the commits and stuff but it just seems like the newer versions made that function disappear.

Mno22:04:30

(js has never been and never will be my friend)