inf-clojure

Jason 2022-12-16T03:58:51.229249Z

for clj I use C-c C-k to invoke (do (load-file "filepath")(in-ns 'namespace)) to reload a file and switch to its' namespace. I'm having difficulty figuring out an equivalent thing for cljs. If I run load-file and then in-ns it works but it leaves an extra []\n in the repl output so I've been trying to sort it out. In the meantime I was wondering why inf-clojure has these as separate commands, do people usually load and set-ns as different commands or is there a different common workflow?

dpsutton 2022-12-16T05:57:11.219919Z

I just require the namespace. I’m not sure that clojurescript has a notion of load file?

dpsutton 2022-12-16T05:58:47.418329Z

and using load-file means each form is essentially fed into a repl so you don't get line number metadata and source therefore won't work

dpsutton 2022-12-16T05:59:54.031349Z

it seems cljs does have load-file. Interesting that you see extra input. If you just type in (load-file "whatever") in the repl do you see the extra input?

Jason 2022-12-19T03:31:01.989719Z

sorry, I was thinking calling require explicitly would change my repl ns

Jason 2022-12-19T03:31:35.286029Z

what I was supposed to be asking is if I'm running a watch process is just in-ns effectively the same thing

dpsutton 2022-12-19T03:32:43.572329Z

You’ll always want the namespace required at least once before doing that

Jason 2022-12-17T02:09:25.838219Z

no, it just goes to the next line 🤔

Jason 2022-12-17T02:12:25.943519Z

(do (load-file "whatever")) gives goog.nodeGlobalRequire is not a function\n:repl/exception!

dpsutton 2022-12-17T02:12:53.520679Z

That sounds like a problem with your code the

dpsutton 2022-12-17T02:13:00.660599Z

Can you require the file?

Jason 2022-12-17T02:14:46.609439Z

yeah. If I'm running a watch process is just require effectively the same thing?

dpsutton 2022-12-17T02:20:13.480849Z

Not sure what you mean. If you just execute (require ‘my.ns) what happens?

dpsutton 2022-12-16T06:00:22.311879Z

the great thing about inf-clojure is that there's not much it does on top of a repl. So if you are seeing that output it is highly likely that that is just what the repl itself is returning

Jason 2022-12-17T02:13:34.314489Z

yeah, I didn't anticipate fixing the issue here, I'm just interested in how other people do the reload and switch namespace workflows