cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
dnolen 2020-05-14T16:36:38.402800Z

small thing but -c -r now feeds the compiler state to the repl

bhauman 2020-05-14T16:37:06.403100Z

cool

bhauman 2020-05-14T16:37:17.403400Z

@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.

bhauman 2020-05-14T16:37:53.404Z

well not situations, on initial compile

dnolen 2020-05-14T16:39:16.405300Z

we resolve type hints - but given all the inference going on the compiler we were too agressive

dnolen 2020-05-14T16:39:33.405800Z

since there are many things we can't know about even if the type might be "known"

bhauman 2020-05-14T16:39:53.406200Z

sounds right

dnolen 2020-05-14T16:40:20.407300Z

so maybe you found a case this somehow misses, I could repro locally after that change

bhauman 2020-05-14T16:40:23.407400Z

and send is on the XhrIo Object not the protocol

dnolen 2020-05-14T16:40:36.407600Z

oh

dnolen 2020-05-14T16:40:44.407900Z

xhrio/send right the REPL probably doesn't use that

dnolen 2020-05-14T16:41:40.408500Z

@bhauman maybe make a little minimal thing?

dnolen 2020-05-14T16:41:46.408700Z

it shouldn't be too hard

bhauman 2020-05-14T16:42:14.408900Z

?

bhauman 2020-05-14T16:42:39.409400Z

oh for now I’m just using js interop

bhauman 2020-05-14T16:42:45.409600Z

to get around the warning

bhauman 2020-05-14T16:43:05.409800Z

to not confuse folks

dnolen 2020-05-14T16:43:19.410Z

like what is the minimal repro?

bhauman 2020-05-14T16:43:33.410800Z

oh I getcha

dnolen 2020-05-14T16:43:35.411100Z

(:require [goog.XhrIo :as xhrio])

dnolen 2020-05-14T16:43:36.411300Z

?

bhauman 2020-05-14T16:43:41.411600Z

yep

dnolen 2020-05-14T16:43:43.411700Z

(xhrio/send ...)

bhauman 2020-05-14T16:43:46.411900Z

yes

dnolen 2020-05-14T16:43:49.412100Z

ok

bhauman 2020-05-14T16:44:35.412700Z

yeah next time I’ll minimal it 😉

bhauman 2020-05-14T16:44:51.413Z

I’m rusty

dnolen 2020-05-14T16:45:52.413200Z

https://clojure.atlassian.net/browse/CLJS-3253

dnolen 2020-05-14T17:13:05.415400Z

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

dnolen 2020-05-14T17:13:43.416300Z

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

bhauman 2020-05-14T17:14:10.417100Z

yeah sounds good, if you want to brainstorm a bit I’m happy to participate

bhauman 2020-05-14T17:14:40.418Z

it would take me a minute to get back into that mindset

dnolen 2020-05-14T17:14:57.418300Z

@bhauman ok no rush, just throwing it out there

dnolen 2020-05-14T17:15:34.420Z

I got hot-loading working in Krell (sans macros) and it was a pretty small effort, and given that hot-reloading is so ubiquitous

dnolen 2020-05-14T17:15:50.420700Z

it's not really an special feature to support anymore

bhauman 2020-05-14T17:16:00.420900Z

if I remember correctly the REPL connection failed after 20 or 30 evals

dnolen 2020-05-14T17:16:27.421800Z

@bhauman hrm that probably old days?

bhauman 2020-05-14T17:16:32.422100Z

so I did have some thoughts about supporting hot reloading in a general way

dnolen 2020-05-14T17:16:47.422800Z

I spent a lot of time working on the REPL connection, so I don't recall seeing anything like that

bhauman 2020-05-14T17:17:53.424300Z

cool

dnolen 2020-05-14T17:18:09.425100Z

but it's true that one thing that's missing is reconnect if something goes wrong

dnolen 2020-05-14T17:18:20.425500Z

i.e. close the browser, reopen etc.

dnolen 2020-05-14T17:18:50.426600Z

which address any failures too if they still exist

bhauman 2020-05-14T17:18:51.426700Z

I did have some thoughts about supporting reload in a more general way in the compiler

bhauman 2020-05-14T17:19:13.427200Z

in a pretty simple way

bhauman 2020-05-14T17:19:40.427800Z

If the compiler could output a changes.edn file

dnolen 2020-05-14T17:19:40.427900Z

not particularly interested in putting it into the compiler since that doesn't seem necessary

dnolen 2020-05-14T17:20:04.428300Z

unless you have some advantages you can enumerate

dnolen 2020-05-14T17:20:19.428900Z

ClojureScript now has a pretty fancy module graph thing

dnolen 2020-05-14T17:20:24.429200Z

it was needed for code splitting

dnolen 2020-05-14T17:20:40.429600Z

you can trivially take a namespace and compute all if it's deps from anywhere

dnolen 2020-05-14T17:20:45.429800Z

direct or full

bhauman 2020-05-14T17:21:08.430200Z

from the client?

dnolen 2020-05-14T17:21:50.431100Z

I mean it could be .cljc

dnolen 2020-05-14T17:21:58.431400Z

the graph stuff doesn't know anything about files or anything else

bhauman 2020-05-14T17:23:14.432900Z

if the compiler emitted the changes in a file, creating a client that does reloads would be trivial

bhauman 2020-05-14T17:23:36.433300Z

it could literally just poll the file

bhauman 2020-05-14T17:23:43.433600Z

no push, no websockets

bhauman 2020-05-14T17:24:20.434100Z

and anyone could write a simple client

dnolen 2020-05-14T17:24:55.434700Z

hrm right, I see - simplify REPL implementations they just serve files

bhauman 2020-05-14T17:25:44.435200Z

yes you could do that for the repl as well

bhauman 2020-05-14T17:26:11.435800Z

now its nice to have push for performance, but we definitely suffer from the complexity

dnolen 2020-05-14T17:27:05.436400Z

this changes file - how does the client know they don't already have it?

bhauman 2020-05-14T17:27:31.436600Z

timestamp in the file

dnolen 2020-05-14T17:27:55.437100Z

seems to implies local storage at least on the client?

bhauman 2020-05-14T17:27:59.437400Z

no

bhauman 2020-05-14T17:28:06.437700Z

in memory

bhauman 2020-05-14T17:28:27.438200Z

there is state on the client anyway

dnolen 2020-05-14T17:28:47.438800Z

oh I guess the assumption here is that client starts at time T

dnolen 2020-05-14T17:28:54.439200Z

only during the REPL session do you care

dnolen 2020-05-14T17:29:14.440Z

i.e. reloads etc don't matter because T gets reset

bhauman 2020-05-14T17:29:14.440100Z

yep you don’t want to eval twice

bhauman 2020-05-14T17:30:22.441500Z

changes file could have the files to be reloaded in the proper order

dnolen 2020-05-14T17:30:39.442100Z

I agree that this is trivial since you can aggregate this in compile-file for the case where we actually do work

bhauman 2020-05-14T17:31:23.443100Z

I’ve been sitting on this idea for like 3 years 🙂

dnolen 2020-05-14T17:32:25.444200Z

make a ticket - it seems harmless to try it and put it behind a flag for people to experiment w/

dnolen 2020-05-14T17:32:35.444700Z

patch would be welcome too

bhauman 2020-05-14T17:32:43.444900Z

we could also provide other helpful information for tooling as well, but I’d have to think it through

dnolen 2020-05-14T17:33:25.445800Z

sure, but for now just a vector of namespaces/paths that changed would be enough

dnolen 2020-05-14T17:34:47.446500Z

would be great to try this first w/ browser REPL

dnolen 2020-05-14T17:34:56.447Z

since I really didn't want to build a file watcher or find one

dnolen 2020-05-14T17:35:07.447300Z

so it's aligned w/ what I'm pondering too

💯 3
bhauman 2020-05-14T17:35:14.447500Z

great!

alexmiller 2020-05-14T17:49:40.448100Z

just fyi, the JDK has a file watcher in it now

😮 1
orestis 2020-05-14T18:42:10.448900Z

Which unfortunately is crap on macOS 😞 https://stackoverflow.com/questions/33379128/does-java-have-native-os-file-system-events-monitoring-support

dnolen 2020-05-14T18:44:21.449500Z

yeah we already use the JDK watcher for watched builds - it's not that good

dnolen 2020-05-14T18:44:37.450Z

with Krell I ended going w/ directory-watcher which is faster on OS X

dnolen 2020-05-14T18:44:48.450400Z

but for browser REPL I'm w/ Bruce, I don't think we need all that machinery