Fork me on GitHub
#cljs-dev
<
2019-04-29
>
dnolen13:04:32

@mfikes and I also have those permissions (re: change JIRA permissions) - so feel free to ping us as well

thheller13:04:57

as far as I can tell every let since then is treated as if it was a loop

thheller13:04:40

(let [x 1
      test-fn (fn [y] (inc y))]
  (test-fn x))
produces
var x_80234 = (1);
var test_fn_80235 = ((function (x_80234){
return (function (y){
return (y + (1));
});})(x_80234))
;
test_fn_80235.call(null,x_80234);

thheller13:04:09

I don't understand why the test-fn is wrapped. that should only be necessary in actual loops?

thheller13:04:56

the above changed the logic which used to check *loop-lets* which would have been nil so it wouldn't do anything

thheller13:04:17

but since () is true-ish it started treating everything as a loop

thheller13:04:22

which seems wrong?

thheller13:04:17

loop-lets    (cond
                       (true? is-loop) *loop-lets*
                       (some? *loop-lets*) (cons {:params bes} *loop-lets*))

thheller13:04:54

*loop-lets* is always at least () so loop-lets will never be nil (it used to be before that change)

thheller13:04:06

the closure compiler doesn't remove the wrapping IIFE either

dnolen13:04:11

it's too long ago for me to remember - it was either a bugfix or a perceived cleanup

dnolen13:04:25

if it's a bugfix maybe it has to something to do w/ recur w/o loop

dnolen13:04:23

which means fns must capture their args to avoid mutation of the loop args

dnolen13:04:56

that's the only thing I can think of - apologies for the bad commit message

alexmiller14:04:41

fyi, in clojure let and loop are the same expr

thheller14:04:05

I understand the wrapper fn in a loop context but most lets are not inside a loop so every fn created inside let bindings has this extra wrapper

thheller14:04:20

but I guess its not easy to know if the fn body will recur

dnolen14:04:19

@thheller I think that's the issue really - I don't think we do multiple passes to figure that out?

thheller14:04:21

IIRC fn* body is analyzed twice

thheller14:04:11

hmm yeah named fns may be analyzed twice but not because of recur. I'll explore a bit more.