Fork me on GitHub
#ghostwheel
<
2020-06-04
>
thheller20:06:49

@clojurians.net it might be good for shadow-cljs users if the main ghostwheel package includes the stubs directly under a different name. then people can use :ns-aliases to use the stubs instead of the actual impl for release builds without having to worry about classpath switching and so on. re-frame-debux does that already, see https://github.com/day8/re-frame-debux#option-2-namespace-aliases-with-shadow-cljs

thheller20:06:17

this feature still needs docs but it is quite useful. so maybe someone can make a case for it some day to get it into regular CLJS too.

gnl16:06:50

That's an easy addition and I don't see any downsides, so yup – sounds good to me, it's happening. :thumbsup:

👍 4
tony.kay21:06:50

So @U05224H0W @clojurians.net The stubs approach without such special support is really not great I think. I mean, you can make it work in the cljs case, but remember that this is CLJC, and if both accidentally end up on your classpath, then you have really screwy behavior, since the first one that is found is what gets used. Worse it is super easy to accidentally get both if you pull in a library that accidentally exports one, and another lib that exports the other. This is not a scalable pattern IMO

☝️ 3
tony.kay21:06:16

I realize that the specs themselves end up pulling in clojure.alpha.spec, which has some code that cannot be DCE’d, and that is the bit I think worthwhile to address at the CLJS compiler level.

thheller22:06:00

I think you misunderstand how this works

thheller22:06:15

it is literally impossible for them to conflict

tony.kay22:06:55

in CLJS I agree, but that is not true on JVM, unless I we are talking abt diff things

thheller22:06:00

or are you talking about the regular stubs? not using :ns-aliases?

tony.kay22:06:11

I’m talking about using GW in CLJ files

tony.kay22:06:13

which is JVM

tony.kay22:06:17

which does not have your feature

thheller22:06:44

I'm only talking about CLJS, this really isn't relevant in CLJ at all since build size is basically a non-factor

thheller22:06:04

so in CLJ it is totally fine to configure this the way you do with guardrails

thheller22:06:32

but in CLJS you CANNOT get rid of the ns requires that your namespace has. so the stub lets you get rid of those cleanly

tony.kay22:06:40

right, but if you accidentally end up with the stubs on the classpath before the real impl, then it will fail

tony.kay22:06:46

and it leaves you scratching your head

tony.kay22:06:49

I’ve had it happen

thheller22:06:19

well my solution with :ns-aliases fixes this ... since there is no secondary package that you are supposed to swap out

tony.kay22:06:27

2 deps with different maven artifact identities but the same nses will hose you

thheller22:06:29

so you cannot end up with both of them on the classpath

tony.kay22:06:38

this is a CLJC library

thheller22:06:40

thats exactly the problem my solution fixes

tony.kay22:06:48

I don’t care about CLJS in this discussion at all

tony.kay22:06:57

if it breaks my server code, I won’t use it

tony.kay22:06:02

which this will

tony.kay22:06:20

shadow-cljs cannot fix a CLJ runtime

thheller22:06:27

I think you missed one important bit here ... there is no extra stubs package.

tony.kay22:06:38

ah, you’re right

tony.kay22:06:41

I did miss that

thheller22:06:43

CLJ continues to work like CLJ does.

tony.kay22:06:07

so you’re saying the stubs will be in the same jar, under a diff name. Got it

thheller22:06:15

CLJS continunes to work. you just have the EXTRA option to specify an alias to use. which lets you get rid of that extra bit you might care about.

tony.kay22:06:28

that’s perfect, actually

tony.kay22:06:34

sorry to doubt you 🙂

thheller22:06:10

I'm completely with you that a secondary package that contains namespaces of the same name is bad

gnl19:06:47

Just to clarify – I was thinking of adding this in addition to offering the separate stubs package with a special version. Same artifact though.

gnl19:06:42

What I plan to remove is the different artifact – ghostwheel-stubs – with the same namespace.