cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
dnolen 2020-06-28T13:56:48.336300Z

compiler and runtime tests now running and passing

dnolen 2020-06-28T13:57:49.336900Z

will add some more JS runtimes, self-host, and REPL tests soon

dnolen 2020-06-28T13:58:19.337600Z

def interested in testing browser REPL, and code splitting in a browser - probably via puppeteer

dnolen 2020-06-28T13:58:45.338200Z

all the things that really shouldn't break but inevitably get missed because there a lot of things to remember

mfikes 2020-06-28T14:32:45.338900Z

🎉

borkdude 2020-06-28T15:16:11.339400Z

Congrats. I've used https://github.com/igrishaev/etaoin for browser testing as well, works fine for all major browsers

dpsutton 2020-06-28T15:40:27.340300Z

is there no uniqueify pass in cljs? that information is kept in a chain of shadow information?

dnolen 2020-06-28T15:55:36.340600Z

@dpsutton like uniquify a symbol?

dnolen 2020-06-28T15:55:57.341300Z

one thing to realize is that the pass stuff came very late to ClojureScript

dnolen 2020-06-28T15:56:11.341900Z

so there might be cases where passes would simplify how things are currently done

dpsutton 2020-06-28T15:58:28.343200Z

the and expansion introduces a let. so i imagine i need to collapse the let and just inline usages of the booleans if i can. so we don't emit (let [x true] (js* "{}~ && {}~" x ...)

dpsutton 2020-06-28T16:14:47.344400Z

so to remove the introduced let need to replace the inline constants with the binding. and to do that need to worry about shadowing. i think the optimizations done at the macroexpansion level are far easier than working on an AST in general.

dnolen 2020-06-28T16:19:33.344700Z

so I'm not following

dnolen 2020-06-28T16:19:41.345Z

the whole point of the macro thing is to remove bindings

dnolen 2020-06-28T16:20:20.345600Z

so the optimization should throw them away you don't need them

dnolen 2020-06-28T16:20:33.345900Z

you just need the right hand side

dnolen 2020-06-28T16:22:28.347200Z

it is true you may need to mark the let with metadata that let's the compiler know it should run an optimization pass on it

dnolen 2020-06-28T16:23:45.348Z

(with-meta '(let ...) {:optimize :and}) or something like that

dnolen 2020-06-28T16:24:15.348500Z

if you see this you know the expression will be a completely regular thing

dnolen 2020-06-28T16:24:32.348800Z

you can collect all the tests, check that they are all boolean

dnolen 2020-06-28T16:24:54.349300Z

and then construct the optimized AST if they are

dpsutton 2020-06-28T16:33:03.350100Z

Ah. I was wondering if I could annotate with something to mark that the expansion came from an and

dpsutton 2020-06-28T16:34:09.350900Z

I think that removes the benefit that other forms will benefit from the optimization though

dnolen 2020-06-28T16:41:21.351600Z

hrm that's true ...

dnolen 2020-06-28T16:42:19.352300Z

but now that I think about you can probably ignore the let and start with if ?

dnolen 2020-06-28T16:42:40.352700Z

and just handle the nested conditionals

dpsutton 2020-06-28T16:43:28.353800Z

Ok. I’ll start there but I’m worried we will be emitting closures around the js* form

dnolen 2020-06-28T16:43:44.354Z

hrm, why?

dnolen 2020-06-28T16:45:01.354800Z

note we're looking for a specific pattern here

dnolen 2020-06-28T16:45:27.355600Z

(if x (let [y exp] (if y ...)) ...)

dnolen 2020-06-28T16:45:44.356200Z

if isn't that specific pattern ignore it

dpsutton 2020-06-28T16:45:49.356500Z

The let is above the if though

dnolen 2020-06-28T16:45:55.356600Z

later we can think about different pass

dnolen 2020-06-28T16:46:02.356800Z

but the let is trivial

dnolen 2020-06-28T16:46:17.357200Z

this what I'm saying, you're looking for nested if with trivial lets

dnolen 2020-06-28T16:46:49.357500Z

if the let form is complex, you just bail

dpsutton 2020-06-28T16:47:00.357700Z

Gotcha

dpsutton 2020-06-28T16:47:06.357900Z

Thanks

dnolen 2020-06-28T18:12:17.358600Z

k I think I have most of the tests running in CI - I did run into trouble with the self-parity tests that I couldn't immediately understand - so that still needs to be done \cc @mfikes

👍 4