Fork me on GitHub

Hello, folks. I want to use spec to define the shape and structure of some data and validate data with it. I'm trying to add some versioning. I'm thinking multiple namespaces could work, e.g. :my.spec.v1/thing, :my.spec.v2/thing, but I'm not sure whether that'd be the right approach. Anyone got any experience with this or general advice?


Seems sensible to me.

Adam Helins17:01:22

I am experimenting with a novel CSS tool for Clojure(script) which is quite drastically changing the way I write CSS. However I do have one major problem with a lack of dead-code elimination. It is not specific to that CSS thing but it's a good example. Essentially, let us suppose a set of namespaces which contains CSS related vars. Some vars are used at runtime, but some are not. Those dead vars are truly dead, there is absolutely nothing using relying on them at runtime. Those are CSS Garden rules that I am sure are not used nor referenced in an advanced build. However, yes, the namespaces containing them are used at runtime. The problem is that those dead vars are not eliminated in advanced builds, which is indeed a problem since they are quite heavy code-wise. I find that intuitively surprising since there is nothing ambiguous or tricky about the fact they are dead. Shadow-cljs advanced build report does not shine any light on the matter. Any idea?


I'd suggest running shadow-cljs release app --pseudo-names and then looking at the actual resulting code

👍 3
thheller17:01:55 will be named foo$bar$thing so it is relatively easy to search stuff


then identify what the code does and that usually tells you why it isn't removed (usually stuff getting stored in an atom or so

Adam Helins18:01:36

@thheller Oh, it's just I might have been mistaken about how smart dead-code elimination is. It's actually not recursive, is it? Because my scenario is essentially this:

(def a {:something 42})

(def b [a])
And b is never used elsewhere. So I was thinking that both a and b would be removed, but they are not. Is it because b references a ?

Adam Helins18:01:34

Well I am not sure that b is not removed, but a definitely isn't.


closure does not recognize all CLJS datastructures as "pure" so some are not removed


simple maps usually are removed but it really depends on whats in them


@thheller: shadow-cljs is amazing, thanks for all the great work.

❤️ 19
💯 10
Adam Helins18:01:57

That must be it because they is literally nothing else going on than gathering maps in vectors. Thanks, very helpful as always!