Fork me on GitHub
#cljs-dev
<
2020-06-28
>
dnolen13:06:48

compiler and runtime tests now running and passing

dnolen13:06:49

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

dnolen13:06:19

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

dnolen13:06:45

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

borkdude15:06:11

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

dpsutton15:06:27

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

dnolen15:06:36

@dpsutton like uniquify a symbol?

dnolen15:06:57

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

dnolen15:06:11

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

dpsutton15:06:28

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

dpsutton16:06:47

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.

dnolen16:06:33

so I'm not following

dnolen16:06:41

the whole point of the macro thing is to remove bindings

dnolen16:06:20

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

dnolen16:06:33

you just need the right hand side

dnolen16:06:28

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

dnolen16:06:45

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

dnolen16:06:15

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

dnolen16:06:32

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

dnolen16:06:54

and then construct the optimized AST if they are

dpsutton16:06:03

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

dpsutton16:06:09

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

dnolen16:06:21

hrm that's true ...

dnolen16:06:19

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

dnolen16:06:40

and just handle the nested conditionals

dpsutton16:06:28

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

dnolen16:06:01

note we're looking for a specific pattern here

dnolen16:06:27

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

dnolen16:06:44

if isn't that specific pattern ignore it

dpsutton16:06:49

The let is above the if though

dnolen16:06:55

later we can think about different pass

dnolen16:06:02

but the let is trivial

dnolen16:06:17

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

dnolen16:06:49

if the let form is complex, you just bail

dnolen18:06:17

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

👍 12