Fork me on GitHub
#clojurescript
<
2017-08-13
>
tony.kay00:08:05

So, it seems that the callback for cljs.loader/load does not get called unless you remember to require cljs.loader in the namespace that is getting loaded, even though that namespace doesn’t use it. Is this expected, and if so, I think this should be added to the docs.

anmonteiro00:08:47

expected, and I think it’s in the guide?

anmonteiro00:08:21

perhaps it’s not

tony.kay00:08:53

Cool. It is in the code, but you could easily overlook it as cruft

tony.kay00:08:01

people require things all the time that aren’t needed

tony.kay00:08:20

@anmonteiro Do you not end up with the same singleton or something? It was very surprising to me, and I’m not exactly a beginner.

anmonteiro00:08:48

I don’t understand the question

anmonteiro00:08:51

can you clarify?

anmonteiro00:08:19

do you mean the moduleManager thing?

tony.kay00:08:34

I don’t understand why it is necessary to require cljs.loader in a namespace that does not use it. Obviously it causes a dep graph to complete (though it would seem to me that the module config should be able to supply that needed fact)

anmonteiro00:08:17

if a namespace should be loaded as a module it needs to require the loader

anmonteiro00:08:22

otherwise you can not require it

tony.kay00:08:24

Bad developer experience 🙂 Why can’t the compiler just figure that out from the module configs?

anmonteiro00:08:04

TBH I don’t recall the exact reason

anmonteiro00:08:12

but I remember David mentioning there’s one

anmonteiro00:08:51

I think in some advanced cases you may want to manage the loading yourself

anmonteiro00:08:16

and injecting the loader would prevent that

anmonteiro00:08:27

^ but I’m not sure about this

tony.kay00:08:40

Well, I’ve spent several hours banging my head on module loading problems. I think I’ve finally got it, but subtle things like that are the kind of thing that lead people to try Clojurescript and just give up because the experience sucks.

tony.kay00:08:13

The code looks simple enough. Nice and trivial. You read the docs and think: yeah! I want that. Then spend a day hitting problems.

tony.kay00:08:27

I guess js-land sucks too 😜

anmonteiro00:08:11

glad you figured it out

anmonteiro00:08:26

there’s definitely space for improvement with regards to docs and developer experience

anmonteiro00:08:45

@tony.kay I would suggest starting a discussion about this on the website repo

tony.kay00:08:49

I’ll send a PR with some additions to the guide

tony.kay00:08:55

thanks for the help

tony.kay00:08:18

@anmonteiro Is the compiler supposed to walk the dep graph for a module, or are we always supposed to list all ns explicitly in the config?

tony.kay00:08:23

I assume the former

tony.kay00:08:46

Yeah, I had to do the latter because of some dynamic resolution that the compiler couldn’t see

Aron04:08:35

any suggestions on how to shim fs and path for node modules in the browser?

Aron05:08:28

only that in my case my target is not :nodejs

Aron05:08:00

and for me it's not assert but fs and path that is required by the third party module

anmonteiro05:08:43

@ashnur if in your case target is not :nodejs why are you trying to require fs or path?

Aron05:08:12

@anmonteiro it's not me who is trying, but an npm module.

anmonteiro05:08:39

so that module may not be suitable to work in a browser

Aron05:08:20

@anmonteiro that's why i was asking how to shim these. like with browserify or something

anmonteiro05:08:34

I don’t know, maybe you need to bundle it with Webpack or browserify

anmonteiro05:08:00

or require only certain files that don’t need fs?

Aron05:08:25

i've been using browserify for many many years now so i am not used to check if a module is written for node or browser, it just works:tm:

Aron05:08:28

i am assuming - perhaps incorrectly - that pre bundling some js files and loading them will not give me the same optimizations that i might get now using only :npm-deps

Aron05:08:20

thanks for the help @anmonteiro!

udit10:08:05

Hi folks! I have the above code snippet which I use to log in via Facebook. As you can see this is async javascript code ported over to clojurescript. What would be the changes that would make the code more idiomatic?

udit10:08:05

I am looking into core.async channels, however I don’t quite understand how to use them here.

pesterhazy11:08:00

Honestly the snippet looks fine to me - hard to improve upon

pesterhazy11:08:17

Don't introduce core.async just because you can

pesterhazy11:08:40

IMO it should be used only when other alternatives have been shown to have real problems in your code, problems which require core.async's primitives, like channels

alex-dixon12:08:27

Is this a bug? Wrong number of args (-1) passed to: macros/session*/fn--57416

alex-dixon12:08:25

And should the error not surface when the parameters of the function are (`[& args]`)?

lepistane13:08:02

oke am i doing something wrong? ajax.cljs post to server and when i use :body it's #object[java.io.ByteArrayInputStream 0x5aec0e6e java.io.ByteArrayInputStream@5aec0e6e] is that normal ? what do i do now?

noisesmith13:08:42

@alex-dixon that means that you somehow got hand of a macro without the metadata indicating it's a macro, so that it got called like a function

noisesmith13:08:51

this can happen when you use the var of a macro

noisesmith13:08:09

what happens is that when a function has :macro true in it's metadata map the clojure compiler adds two args to the beginning of the arg list, &env and &form representing local bindings and the raw form of the macro invocation, then it captures the result of calling the macro, then compiles the output of the macro

alex-dixon13:08:27

Well. Apparently I just realized I don’t know how to use alter-meta!. And still don’t

noisesmith13:08:51

so, if you call a macro that doesn't have that metadata on it, you end up with a "negative argument count"

alex-dixon13:08:56

Calling it from a cljs repl on an interned var free of macros doesn’t seem to be working how I expected

noisesmith13:08:03

because a macro with two args is really called with 0 args, etc.

noisesmith14:08:17

oh wow even with the deref I am getting the correct 0, hmm...

alex-dixon14:08:28

I’ve passed the amount of time I told myself I would spend on this but…

alex-dixon14:08:59

(def ^{:cool true} foo "hey")
(var foo)
(alter-meta! (var foo) merge {:cool "yes"})
(println "Foo meta" (meta (var foo)))
=> Foo meta {:cool true, :ns precept.app-ns, :name foo, :file /Users/alexdixon/precept/test/macros/cljs/precept/app_ns.cljs, :end-column 23, :column 1, :line 61, :end-line 61, :arglists (), :doc nil, :test nil}

alex-dixon14:08:45

Would expect :cool to be “yes”…what am I missing?

noisesmith14:08:38

@alex-dixon that code would work in jvm clojure...

noisesmith14:08:42

(just tested it)

alex-dixon14:08:34

Just updated to 854 which should be the latest and getting the same behavior

gcast14:08:52

well I believe merge takes the value of the left argument in the event of a keyword collision

gcast14:08:21

woops nvm

noisesmith14:08:27

like I said, that code works correctly in clj - merge goes with rightmost

noisesmith14:08:21

@gcast the easy way to remember is that for many vararg clojure functions, (f a b c) is the same as (f (f a b) c) - thus it needs to prefer the rightmost arg (see for example str, *, -, /, or, and, conj)

gcast14:08:56

ahh because they are reducers?

noisesmith14:08:16

right - even if not written with reduce (which most of them are), they keep that semantic

gcast14:08:39

cool. thanks

dnolen15:08:20

@tony.kay certainly nothing is final wrt. the behavior of cljs.loader, but my assumption was that people would commonly use the loader via routing, in that case you never know which thing will load which thing - so you would include the loader in every entry point anyway

dnolen15:08:11

@tony.kay also if that was a significant time sink (I’m also curious what else you hit), then we should talk about that more.

dnolen15:08:03

it would be pretty simple to warn on attempting to load a module that doesn’t require cljs.loader

naomarik16:08:19

there an equivalent to jquery’s document ready? I have some JS loaded with an async tag and I can’t depend on the script loading before the DOM so goog events DOMCONTENTLOADED is not an option

urbank16:08:20

Is anyone here in the habit of clojure-spec-ing their app states? How thorough do you tend to go with the specs? Every bit of the structure or just the leafs?

qqq18:08:57

I have this weird problem. Reagent is rendering"Hello World" -- yet that string appears no where in my html / clj / cljs files.

qqq18:08:58

(set! (.-onload js/window)
        (fn [& rst]
          (. js/console log "onload window called")
          (init)))
is this the correct way to get (init) to be called on startup? if not, what is the corrcet way (it's not working for me)

qqq18:08:59

resolved -- problem was elsewhere, above code worked fine for setting onload

tony.kay18:08:42

@dnolen I would think you’d only include cljs.loader in those things that actually call it. Routing is exactly what I was building, and the “leaves” never need to load anything else. Thus, my callback not getting called when those were loaded just left me scratching my head and thinking I’d made some “silly” typo or mistake. The other thing I hit was related to using it in devcards or perhaps because I am building a reusable routing component. I am not sure exactly why I had to add so much to :entries. It could be that because I’m triggering the routing through an Om mutation that it could not figure out the dependency graph info? The namespace for routing was required, but the routing namespace wasn’t known when it tried to look up “loader”. My suspicion was that the compiler couldn’t analyze the dependency graph from the requires, but I didn’t understand how that works very well from the documentation. I expected to be able to add my “entry points” for the modules to the config and have the rest derived, but I had to add a lot more to :entries than I expected, and I had to essentially tinker until I figured that out. I still would have expected it to work. Perhaps that is a bug? The cljsbuild config that worked is: https://github.com/fulcrologic/fulcro/blob/develop/src/main/fulcro/client/routing.cljc#L297 :main in my case is the main route that is dynamically loaded. But I had to explicitly add the routing namespace to the :entries (which is where the call to load comes from…through an Om mutation). I was expecting that to get picked up through requires (the namespace that triggers the mutation requires the routing namespace). I’m gathering now that perhaps the analysis works by looking for just requires of cljs.loader? The documentation led me to believe that loader was just a utility component to triggering/tracking loads. It was not clear to me that it was more (e.g. something used by the analyzer?).

dnolen18:08:56

@tony.kay you also don’t seem aware how the undelrying thing works 🙂

dnolen18:08:22

I highly recommend picking up Closure: The Definitive Guide

dnolen18:08:11

anyways the point is fundamentally you must require cljs.loader if you going to be loaded by cljs.loader because you must call set-loaded!

dnolen18:08:25

whatever you may think is going on is not so relevant

dnolen18:08:37

it’s just how goog.module.ModuleLoader works period

tony.kay19:08:30

When I’ve written module code before, you had to add something to the namespace to trigger the event that signaled completion.

dnolen19:08:43

set-loaded!

dnolen19:08:03

but you can’t even call that

dnolen19:08:12

without requiring cljs.loader first

tony.kay19:08:22

but is that automatic now?

dnolen19:08:24

so obviously you must require it

dnolen19:08:32

in anyplace that will be loaded

dnolen19:08:48

but I agree this isn’t intuitive

dnolen19:08:53

because people are not reading the docs first

dnolen19:08:05

and I agree that’s not unexpected

dnolen19:08:07

so a warning

dnolen19:08:43

set-loaded! is only called for you if you require cljs.loader

dnolen19:08:55

it’s added to the end of the file that required cljs.loader

tony.kay19:08:59

Right, which is magic. I was complaining about the docs more than anything 🙂

dnolen19:08:16

docs will only help so much

tony.kay19:08:18

I’d rather see an explicit requirement for set-loaded! than no docs on magic

dnolen19:08:23

I agree we should say something about it

dnolen19:08:31

but the simpler thing is to just warn and tell you what to do

tony.kay19:08:05

wanrings end up in the console with lots of other messages .Certainly helpful. Clear comment in the docs that is needed are good too

dnolen19:08:23

but the docs will only make partial sense is what I’m saying

dnolen19:08:31

you must read Closure docs to actually understand

dnolen19:08:50

so I’m not sold on doing much in the docs

dnolen19:08:05

other than “RTFM” because it’s gonna take too long to repeat it all over again

tony.kay19:08:42

The thing is code flow: I, as a developer, would understand an explicit call to set-loaded! as a requirement for the callback to trigger. It is a traceable code path. A require is for library loading. Overloading it to augment your code with a hidden action is not remotely expected.

dnolen19:08:04

or we could just remove the magic stuff

dnolen19:08:09

and then you go figure it out on your own

tony.kay19:08:14

I would honestly prefer that

tony.kay19:08:24

because then the docs would show it being called in an example

dnolen19:08:25

but everyone would spend even more time than you did

dnolen19:08:32

all of this could have been avoided

dnolen19:08:36

by actually reading the original docs

dnolen19:08:51

@tony.kay you can disagree but this has already come up multiple times

dnolen19:08:58

it’s not your like the first person to bring this up

dnolen19:08:03

and I couldn’t even figure it out myself

dnolen19:08:13

without reading the Closure book

dnolen19:08:18

the source code is not forthcoming

dnolen19:08:19

which is to separate your personal frustration from something that should work for people that aren’t going to read docs

tony.kay19:08:22

I’m disagreeing because had your guide set set-loaded! at the bottom of a source file I would have not hit an issue

dnolen19:08:00

but people can forget to do that

dnolen19:08:04

and then what?

tony.kay19:08:24

I’m wanting something that works when you read the docs. I don’t give a rats ass if people cause themselves problems by not reading anything. I read your guide. One simple comment about set-loaded would have kept me from having any problems. And I’ve written module loading before with Closure.

dnolen19:08:48

anyways I’m not going to listen to (only one) personal anecdotes 🙂

dnolen19:08:53

your feedback has been heard

dnolen19:08:15

first step is adding the warning

dnolen19:08:20

and then collect more feedback

dnolen19:08:30

nothing is set in stone, it’s a new feature

tony.kay19:08:00

That will probably do it. I understood there was “magic” going on somewhere. I just didn’t realize it was in the require.

dnolen19:08:23

some of this is because implementation details

dnolen19:08:43

a desire to make it easy w/o actually having to write a whole bunch of injection code

dnolen19:08:48

which I’m totally uninterested in

dnolen19:08:34

@tony.kay but thanks for trying it and wading through it, the feedback is in fact very welcome

tony.kay19:08:31

And thank you for working on it. It’s a big improvement.

tony.kay19:08:07

Fulcro now has a completely dynamic UI routing system with module loading integration…and it is about to have automatic i18n locale loading.

tony.kay19:08:21

So your efforts are not lost on me 🙂

tony.kay19:08:32

@dnolen So am I right in saying that, in order to call load a namespace must be explicitly listed in a module in the compiler config’s :entries ( it cannot just be derived by the require graph)?

dnolen19:08:21

@tony.kay I don’t know what you’re saying

dnolen19:08:25

you can’t load namespaces

dnolen19:08:27

just modules

tony.kay19:08:35

I understand that.

tony.kay19:08:51

Say I have namespace A, and it wants to load module :m

tony.kay19:08:19

If I don’t put namespace A into an explicit module in compiler config, then loaded is unset when it calls the load for :m

tony.kay19:08:25

and it crashes

tony.kay19:08:43

even though an entry point that requires A is in a module

tony.kay19:08:20

My understanding was that the compiler would derive all the stuff needed for a module through the require graph

dnolen19:08:40

you’re talking about too many different things for me to understand anything at all 🙂

dnolen19:08:54

set the compiler stuff aside

dnolen19:08:59

just focus on the first statement

tony.kay19:08:17

Concrete: namespace “router” is a namespace that loads various modules. The module name is given to it by parameter. Thus, it might load any number of modules. When you call the load macro, it tries to derive the module that you’re loading from. Right so far?

dnolen19:08:33

I don’t care about routing

dnolen19:08:41

and I don’t want to talk about it

dnolen19:08:45

all I care about is the semantics of loading

tony.kay19:08:01

I’m jsut trying to give you an example that makes it easy to talk about

dnolen19:08:08

it’s not making it any easier 🙂

dnolen19:08:13

so hold on

dnolen19:08:36

you may be talking about a reason to get rid of the magic set-loaded! call is why

dnolen19:08:51

just listen

dnolen19:08:55

and don’t jump to any conclusions

dnolen19:08:21

so first question - why would A need to load if it’s not an entry point?

tony.kay19:08:39

it is a namespace within the namespaces of the entry point.

dnolen19:08:57

but what is rationale for not loading from one place

dnolen19:08:04

I am just asking a simple question

tony.kay19:08:05

composition of libraries

tony.kay19:08:31

one of the namespaces is a reusable library component whose task is to load things (e.g. routing)

tony.kay19:08:39

another library element loads locales (i18n). Separate concern. Separate library even.

dnolen19:08:33

ok but then doesn’t it sound like appending set-loaded! for you when you require cljs.loader a problem? It does to me

dnolen19:08:40

generic thing doesn’t know the module is loaded, only you do

tony.kay19:08:34

I assumed set-loaded was idempotent…once the thing is loaded it doesn’t hurt for it to be called

dnolen19:08:07

it is idempotent … but it might not be true the module is actually loaded (if there are multiple entries)

tony.kay19:08:44

one namespace calls it, but some others aren’t there yet

tony.kay19:08:52

possible overlap

dnolen19:08:26

so this makes me feel like the magic set-loaded! thing is just broken

dnolen19:08:35

and really we should leave this to users

tony.kay19:08:38

that could explain some of the strangeness I’m seeing

tony.kay19:08:05

I was assuming it was in the derivation of what module things went with in the dependency graph.

tony.kay19:08:42

but cljs_base is a likely place for things

dnolen19:08:56

without the the magic set-loaded! thing, cljs.loader becomes a fully generic useful programmable thing

dnolen19:08:41

it also means the other requirement goes away

dnolen19:08:55

no more unused cljs.loader for entries that are only going to be loaded

tony.kay19:08:07

so, I have a question: what is required in :entries now? Just the entry point of a module, or everything you want to try to force to be in that module.

dnolen19:08:31

yeah different topic, but OK

tony.kay19:08:35

I mean, it will move it up if needed by more than one.

dnolen19:08:45

:entries is just about pinning something to a module

tony.kay19:08:48

related topic. I have an idea, but I need to be clear on intentions

dnolen19:08:50

it should not move

dnolen19:08:01

if it needs to move you made a mistake

dnolen19:08:06

and never should have put it there in the first place

dnolen19:08:31

:entries should only be exactly what you want where

tony.kay19:08:32

ok, so what can’t you use that to add the magic?

dnolen19:08:39

everything else should be left to the compiler

dnolen19:08:59

there is no required dep order for :entries

dnolen20:08:06

they may all be leaves

dnolen20:08:21

so only the user knows which one should call set-loaded!

tony.kay20:08:35

but if it is idempotent, can’t they all?

dnolen20:08:49

because don’t know which one matters

dnolen20:08:58

no idea what your app is doing

dnolen20:08:44

problem with leaf nodes is they often have side effects at the top level

dnolen20:08:52

no way to understand that stuff

tony.kay20:08:08

ok, I trust you on that. My naive understanding.

dnolen20:08:27

so I’m leaning towards just removing the magic

dnolen20:08:33

then cljs.loader becomes a normal tool

tony.kay20:08:02

That’s too bad. The magic would be nice 😉

tony.kay20:08:36

Could also add an additional compiler config entry to indicate exactly which namespace is the rep for the module

dnolen20:08:38

I just don’t see how to reconcile it programmability

dnolen20:08:44

customizing loading seems too valuable

dnolen20:08:03

@tony.kay more compiler config for this is not desirable

tony.kay20:08:12

yeah, I tend to agree

tony.kay20:08:19

just brainstorming

dnolen20:08:44

yeah I just think the ease stuff actually gets in the way of composability

dnolen20:08:54

and writing useful stuff on top of cljs.loader is impossible with current design

dnolen20:08:57

that seems like a huge flaw

tony.kay20:08:55

It has felt a little “eye of toad, blood of goat” so far 😜

tony.kay20:08:48

So, one more possible problem: pinning to a module. Is it true you must pin something to a module if it is going to call load? I.e. that ns cannot end up in cljs_base?

tony.kay20:08:11

or rather, it must at least have a known named module

tony.kay20:08:21

if it ends up in base, that is a separate matter I guess

dnolen20:08:50

@tony.kay no, if we fix 2321, you can call load whenever you want

dnolen20:08:14

as long as that calling module has called set-loaded! itself of course

tony.kay20:08:20

ok. I was seeing an issue where I was having to pin my router to a module, even though it was acceptable to be in base

dnolen20:08:01

oh so there is a related problem here

tony.kay20:08:02

oh, I see. So the router is going to have to be in an explicit module in the compiler config

dnolen20:08:54

which is that we never actually call set-loaded! on :cljs-base

dnolen20:08:06

instead what we do is that when you call set-loaded! on your own module

dnolen20:08:18

then we ensure all parent modules have set-loaded! called on them

dnolen20:08:23

but we need to be very careful here

dnolen20:08:37

code splitting, and cljs.loader are two completely independent features

dnolen20:08:52

you can use the former w/o the later

dnolen20:08:06

and having the later bleed into the former is undesirable

tony.kay20:08:39

That was the root of my confusion. I didn’t see how you could implement the latter well without it bleeding into the former…so I was assuming it was part of it.

dnolen20:08:49

it’s just not going to happen

dnolen20:08:54

so take that as a base assumption

tony.kay20:08:01

ok, then magic is out 🙂

tony.kay20:08:35

that was part of the reason I didn’t dig into the source…I assumed it was a mountain of madness of dep resolution 🙂

dnolen20:08:53

no not at all

dnolen20:08:09

module loading is really dumb

dnolen20:08:18

nothing happens at runtime

dnolen20:08:33

we compute the module graph at compile time

mfikes20:08:33

IIRC the magic wasn't there to start with, right? It was only added after some discussion

dnolen20:08:05

yeah, shadow-cljs does some stuff here, but perhaps it can work around these issues w/ injection

dnolen20:08:17

but I don’t want to do that, and the ease stuff just is getting in the way

tony.kay20:08:30

The entries form the root set of a DAG, though, right?

tony.kay20:08:22

nvm. still thinking about the magic, and I agree it is better just to have explicit calls to set-loaded!

dnolen20:08:52

the problems and complications just disappear

dnolen20:08:08

once again Hickey was right

anmonteiro20:08:56

I added a comment in CLJS-2321

anmonteiro20:08:12

not sure about the cljs_base issues, but it might be as easy as reverting CLJS-2157

dnolen20:08:55

@anmonteiro yeah that’s what I was looking at - thanks for adding the comment

dnolen20:08:19

@tony.kay the magic that remains which is probably what you’re getting at is that cljs.loader will remain a magic ns

dnolen20:08:30

we insert the module graph into that ns when we compile that ns

dnolen20:08:54

and that ns is marked dirty whenever the module graph changes

tony.kay20:08:54

Cool. And you see a resolution for the cljs_base library problem?

dnolen20:08:41

@tony.kay I don’t really see the problem anymore

dnolen20:08:48

it’s not a entry point, it should not load at the top level

tony.kay20:08:58

loader will be nil

tony.kay20:08:21

library code that ends up in cljs_base will have a problem

dnolen20:08:26

that stuff will probably be removed

dnolen20:08:34

basically walking backwards from all this easy stuff

dnolen20:08:52

and simply just thin layer over moduleloader + module graph injection

dnolen20:08:16

people must read the docs

tony.kay20:08:38

And a library author will have to tell ppl to explicitly place certain namespaces into a module (those that call load)

dnolen20:08:17

I don’t see why

tony.kay20:08:36

I thought those ns’s that call load have to call set-loaded

dnolen20:08:41

they do not

dnolen20:08:45

cljs.loader has the module graph

dnolen20:08:07

they’ve already called set-loaded!

dnolen20:08:54

yeah once everybody reads the docs

dnolen20:08:05

then writing composable stuff on the base assumptions just falls out

tony.kay20:08:38

well, I’ll be glad to test it when you’re ready 🙂

tony.kay20:08:04

happy to do so against master before release

dnolen20:08:09

great thanks

dnolen20:08:14

yeah this was super helpful

dnolen20:08:19

definitely needs to be in the next release

dnolen22:08:02

@tony.kay removed automatic set-loaded! calls from master

dnolen22:08:17

if you have time to test that would be great

dnolen22:08:31

I’ve left the module loader assertion alone, seems to me that should be fine - but maybe you’ll demonstrate otherwise

dnolen22:08:11

I’d like to cut a release tomorrow, gotta head out for now but I will check back in later

tony.kay22:08:03

@dnolen that was fast. I’ll take a look.

tony.kay23:08:58

@dnolen OK, I tested it out. The explicit calls to set-loaded! work fine, as I’d expect. When I use figwheel, it does throw an exception, but even then it does work. I suspect figwheel is going to need a little tweak. The exception, for general interest was:

ioc_helpers.cljs?rel=1502666299392:42 Uncaught TypeError: goog.net.jsloader.load is not a function
  4     at figwheel$client$file_reloading$reload_file_in_html_env (file_reloading.cljs?rel=1502666284269:208)
  5     at figwheel$client$file_reloading$reload_file (file_reloading.cljs?rel=1502666284269:250)
  6     at figwheel$client$file_reloading$blocking_load (file_reloading.cljs?rel=1502666284269:269)
  7     at file_reloading.cljs?rel=1502666284269:279
  8     at file_reloading.cljs?rel=1502666284269:277
  9     at figwheel$client$file_reloading$state_machine__54034__auto____1 (file_reloading.cljs?rel=1502666284269:277)
 10     at figwheel$client$file_reloading$state_machine__54034__auto__ (file_reloading.cljs?rel=1502666284269:277)
 11     at cljs$core$async$impl$ioc_helpers$run_state_machine (ioc_helpers.cljs?rel=1502666299392:35)
 12     at cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped (ioc_helpers.cljs?rel=1502666299392:39)
 13     at ioc_helpers.cljs?rel=1502666299392:48
However, I was hoping a specific library-centric scenario would end up working, but it does not. It is possible that I misunderstood you. - Library ns L issues loads. It is required by all namespaces in this example (and it does end up in cljs_base). - Entry point ns E is in :entry-point module E :modules {:entry-point { :entries #{E} ... - Module M (to be loaded by L), is in modules {:m {:entries #{M} … If I force L into the entry point module (`:entries #{E L}`), then it works. As I said, I may have misunderstood you. If that is how it is supposed to work, then it does. I thought you had a solution for stuff that issued loads from library code in cljs_base (like a top-level module for cljs_base that was always considered preloaded). The specific error I get when L is not specifically pinned is: `Assert failed: Module does not exist (contains? module-infos module-name)`. This is what I was talking about when I said the loader would not be defined, since the namespace L was not pinned.

anmonteiro23:08:46

^ this error message also looks a little strange

anmonteiro23:08:52

because the module name looks null

anmonteiro23:08:59

in Module does not exist

anmonteiro23:08:12

2 spaces where a name should be

tony.kay23:08:23

I know. It should be the name of the loader namespace

anmonteiro23:08:51

or :cljs_base no?

tony.kay23:08:23

that tries to look up which module the ns is in, but L isn’t pinned, so it isn’t in one as far as the data structure is concerned

tony.kay23:08:37

that’s why pinning it fixes the problem

tony.kay23:08:13

that’s why I was referring to there being the need for some kind of “default” module that we know is loaded

anmonteiro23:08:20

oh yeah that totally makes sense

anmonteiro23:08:36

I don’t know if that’s supposed to work, but makes sense to me that it should

anmonteiro23:08:20

however, it does seem a little odd to me that library code would dictate split points

tony.kay23:08:31

what do you mean?

tony.kay23:08:50

the library isn’t dictating anything…it’s just ending up in base because it is used by things

anmonteiro23:08:26

but the library is calling cljs.loader/load!, no?

tony.kay23:08:40

yes, it is.

anmonteiro23:08:02

right. that’s what I find might not be idiomatic, if there’s a word for it

anmonteiro23:08:25

shouldn’t it be up to application code to take care of loading?

tony.kay23:08:30

It depends on who knows that is in cljs_base. If only Google Closure knows whats in base, then there’s nothing to be done. But if cljs builds that, then it does know what is in the base module.

tony.kay23:08:53

and that could just be placed in the deps thing that is being generated for cljs.loader

tony.kay23:08:14

it has to be cljs, though, because it works with opt none, right?

anmonteiro23:08:17

I guess there’s some distinction here of splitting vs loading that David was speaking of earlier that I’m not really getting yet

anmonteiro23:08:52

I think CLJS knows what’s in base

tony.kay23:08:07

loading is standalone. It just loads things that are defined. It does, however, tried to load things in dependency order.

tony.kay23:08:17

which is why there is an injected module info

tony.kay23:08:31

it seems to me the lack of cljs_base being part of that story is a hole

tony.kay23:08:44

it isn’t a module, but it sure is split code

anmonteiro23:08:59

right. In case it is supposed to work, there might be a bug here wrt cljs-base

tony.kay23:08:49

there is the possibility that I’m msising something. What if L was placed into a module explicitly. In that case, it will work because that is the design (and you better do the proper calls to set-loaded!. But the assumption is that a caller of load should be in something that was already properly loaded…e.g. a module with an invocation of set-loaded!. But your 3rd party is the app writer using cljs AND a library L. For them, L is just going to end up in cljs_base. It would be nice if they can just use it, and an implicit set-loaded! has already happened for the cljs_base “preload”

tony.kay23:08:45

otherwise your library author has to document what namespaces need to be pinned, and we then have a huge library dependency nightmare…I use a lib that uses a lib that uses a lib that needs to be pinned into a module to work

tony.kay23:08:13

composition collapses into compiling things for 1990's Linux