small thing but -c -r
now feeds the compiler state to the repl
cool
@dnolen there is another less critical but persistent error I’m seeing, and that is xhrio/send always throws a missing var warning from the compiler in situations that it never has before.
well not situations, on initial compile
hrm this sounds like https://github.com/clojure/clojurescript/commit/f4631853660526a0ffbd9a57f3335d9bc005f551
we resolve type hints - but given all the inference going on the compiler we were too agressive
since there are many things we can't know about even if the type might be "known"
sounds right
so maybe you found a case this somehow misses, I could repro locally after that change
and send is on the XhrIo Object not the protocol
oh
xhrio/send
right the REPL probably doesn't use that
@bhauman maybe make a little minimal thing?
it shouldn't be too hard
?
oh for now I’m just using js interop
to get around the warning
to not confuse folks
like what is the minimal repro?
oh I getcha
(:require [goog.XhrIo :as xhrio])
?
yep
(xhrio/send ...)
yes
ok
yeah next time I’ll minimal it 😉
I’m rusty
I'm pondering a bit to making the standard browser REPL a bit more useful, so that people (beginners really) don't immediately feel the need to make a jump to something else - you had some thoughts here @bhauman - I'm wondering if it's really anything more than basic hot loading - no whistles - & some better strategy for for mime-types / encoding
not interested in encroaching on all the other great tools, rather if somebody starts with brower REPL they could hack on something cool for a while and not worry about other decisions
yeah sounds good, if you want to brainstorm a bit I’m happy to participate
it would take me a minute to get back into that mindset
@bhauman ok no rush, just throwing it out there
I got hot-loading working in Krell (sans macros) and it was a pretty small effort, and given that hot-reloading is so ubiquitous
it's not really an special feature to support anymore
if I remember correctly the REPL connection failed after 20 or 30 evals
@bhauman hrm that probably old days?
so I did have some thoughts about supporting hot reloading in a general way
I spent a lot of time working on the REPL connection, so I don't recall seeing anything like that
cool
but it's true that one thing that's missing is reconnect if something goes wrong
i.e. close the browser, reopen etc.
which address any failures too if they still exist
I did have some thoughts about supporting reload in a more general way in the compiler
in a pretty simple way
If the compiler could output a changes.edn file
not particularly interested in putting it into the compiler since that doesn't seem necessary
unless you have some advantages you can enumerate
ClojureScript now has a pretty fancy module graph thing
it was needed for code splitting
you can trivially take a namespace and compute all if it's deps from anywhere
direct or full
from the client?
I mean it could be .cljc
the graph stuff doesn't know anything about files or anything else
if the compiler emitted the changes in a file, creating a client that does reloads would be trivial
it could literally just poll the file
no push, no websockets
and anyone could write a simple client
hrm right, I see - simplify REPL implementations they just serve files
yes you could do that for the repl as well
now its nice to have push for performance, but we definitely suffer from the complexity
this changes file - how does the client know they don't already have it?
timestamp in the file
seems to implies local storage at least on the client?
no
in memory
there is state on the client anyway
oh I guess the assumption here is that client starts at time T
only during the REPL session do you care
i.e. reloads etc don't matter because T gets reset
yep you don’t want to eval twice
changes file could have the files to be reloaded in the proper order
I agree that this is trivial since you can aggregate this in compile-file
for the case where we actually do work
I’ve been sitting on this idea for like 3 years 🙂
make a ticket - it seems harmless to try it and put it behind a flag for people to experiment w/
patch would be welcome too
we could also provide other helpful information for tooling as well, but I’d have to think it through
sure, but for now just a vector of namespaces/paths that changed would be enough
would be great to try this first w/ browser REPL
since I really didn't want to build a file watcher or find one
so it's aligned w/ what I'm pondering too
great!
just fyi, the JDK has a file watcher in it now
Which unfortunately is crap on macOS 😞 https://stackoverflow.com/questions/33379128/does-java-have-native-os-file-system-events-monitoring-support
yeah we already use the JDK watcher for watched builds - it's not that good
with Krell I ended going w/ directory-watcher which is faster on OS X
but for browser REPL I'm w/ Bruce, I don't think we need all that machinery