ghostwheel

Hassle-free clojure.spec, automatic generative testing, side effect detection, and evaluation tracing for Clojure(-Script) – https://github.com/gnl/ghostwheel
thheller 2020-06-04T20:02:49.035300Z

@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

thheller 2020-06-04T20:04:17.037300Z

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.

gnl 2020-06-05T16:16:50.037600Z

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

👍 1
tony.kay 2020-06-06T21:51:50.039500Z

So @thheller @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

☝️ 1
tony.kay 2020-06-06T21:53:16.039700Z

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.

thheller 2020-06-06T22:03:00.040Z

I think you misunderstand how this works

thheller 2020-06-06T22:03:15.040200Z

it is literally impossible for them to conflict

tony.kay 2020-06-06T22:03:55.040400Z

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

thheller 2020-06-06T22:04:00.040600Z

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

tony.kay 2020-06-06T22:04:11.040800Z

I’m talking about using GW in CLJ files

tony.kay 2020-06-06T22:04:13.041Z

which is JVM

tony.kay 2020-06-06T22:04:17.041200Z

which does not have your feature

thheller 2020-06-06T22:04:44.041400Z

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

thheller 2020-06-06T22:05:04.041600Z

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

thheller 2020-06-06T22:05:32.041800Z

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.kay 2020-06-06T22:05:40.042Z

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

tony.kay 2020-06-06T22:05:46.042300Z

and it leaves you scratching your head

tony.kay 2020-06-06T22:05:49.042500Z

I’ve had it happen

thheller 2020-06-06T22:06:19.042700Z

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

tony.kay 2020-06-06T22:06:27.042900Z

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

thheller 2020-06-06T22:06:29.043100Z

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

tony.kay 2020-06-06T22:06:38.043300Z

this is a CLJC library

thheller 2020-06-06T22:06:40.043500Z

thats exactly the problem my solution fixes

tony.kay 2020-06-06T22:06:48.043700Z

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

tony.kay 2020-06-06T22:06:57.043900Z

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

tony.kay 2020-06-06T22:07:02.044100Z

which this will

tony.kay 2020-06-06T22:07:20.044300Z

shadow-cljs cannot fix a CLJ runtime

thheller 2020-06-06T22:07:27.044500Z

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

tony.kay 2020-06-06T22:07:38.044700Z

ah, you’re right

tony.kay 2020-06-06T22:07:41.044900Z

I did miss that

thheller 2020-06-06T22:07:43.045100Z

CLJ continues to work like CLJ does.

tony.kay 2020-06-06T22:08:07.045300Z

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

tony.kay 2020-06-06T22:08:09.045500Z

:thumbsup:

thheller 2020-06-06T22:08:15.045700Z

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.kay 2020-06-06T22:08:28.045900Z

that’s perfect, actually

tony.kay 2020-06-06T22:08:34.046100Z

sorry to doubt you 🙂

thheller 2020-06-06T22:09:10.046700Z

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

gnl 2020-06-07T19:17:47.047500Z

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

gnl 2020-06-07T19:18:42.047700Z

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