cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
2020-11-08T13:21:04.057300Z

I’ve updated these tests with 4 cases - https://github.com/clojure/clojurescript/compare/master...mhuebert:cljc-macros-require-test observed behaviour: • failure (expected): a cljc macro namespace :require’s another namespace containing macros, which does not “self-require”. when the macro is used, there is no resolve warning & the macro function is called without arguments being correctly passed to it (see wrap-1). Seems reasonable that this does not work - the compiler has no way to know that the ns has macros, unless :require-macros is called somewhere, so a $macros ns is never created. though perhaps should warn? • failure (bug?): a cljc macro namespace :require-macro’s another namespace containing macros. consuming the macro always fails, does not matter if the other ns self-requires. (see wrap-2). error occurs when trying to resolve the alias.. does namespace resolution in syntax-quote follow :require-macros aliases? this may be a bug? • success: a cljc macro namespace :require’s another namespace, which self-requires. (see wrap-3, and wrap-4 for a variant with both cljs + cljc files)

2020-11-08T13:22:01.057400Z

additionally it looks like alias resolution fails in more cases in shadow’s bootstrap build (cc @thheller) - I added a couple failing examples here, including the issue with reagent macros: https://github.com/mhuebert/shadow-bootstrap-example/blob/1d5cadbb013660b4e0bea80a8ee9ea4a544ec2ab/src/shadow_eval/core.cljs#L32

thheller 2020-11-08T16:19:28.059Z

@mhuebert the tests you are doing all start at the same time so they are all racing against each other. you need to ensure that one eval completes before the next one runs. at least that would eliminate some of the randomness?

thheller 2020-11-08T16:20:06.059300Z

probably better to have one deftest for each instead of the latch thing?

2020-11-08T16:20:44.060400Z

I think I’ve eliminated the randomness by using a different namespace for each test

2020-11-08T16:21:34.061600Z

The cause is how cljs ns forms work, different from clj I believe

thheller 2020-11-08T16:21:51.061800Z

no I mean that all the eval-str calls are kicked off in the same cycle

thheller 2020-11-08T16:22:14.062300Z

so depending on when they go async or even if they go async the order they complete in is more or less random

thheller 2020-11-08T16:22:45.063200Z

so each eval-str should only the done once the previous completes

thheller 2020-11-08T16:23:22.064300Z

at least thats what looks suspicious to me about the tests. whether or not that actually affects anything I do not know but the async behaviour is "bad"

2020-11-08T16:23:30.064600Z

Right, but the order shouldn’t matter if operating on different namespaces, or otherwise not interacting? I just based it on how the cljs self host tests are set up

2020-11-08T16:24:14.065600Z

I agree it would be cleaner to have them run sequentially

thheller 2020-11-08T16:24:54.066Z

well at least from a theory perspective I can see how one eval sees that a namespace is not yet loaded and kicks off the async load. the next eval does the same ending up in loading the namespace twice and so on

thheller 2020-11-08T16:25:59.066800Z

its just one thread but that doesn't mean things can't get weird at times 😉

2020-11-08T16:26:12.067300Z

Yeah. I’ll rejig them to be sequential

2020-11-08T16:34:07.068600Z

I don’t think any of these tests are anymore tho

2020-11-08T22:43:32.069300Z

i also updated the mhuebert/shadow-bootstrap-example project to use a queue