sweet-core icon indicating copy to clipboard operation
sweet-core copied to clipboard

Scoping issues with default parameters

Open gabejohnson opened this issue 8 years ago • 1 comments

function foo(a = 1, b = a) { return a + b; }

should result in:

function foo(a_100 = 1, b_101 = a_100) {
  return a_100 + b_101;
}

but instead yields:

function foo(a_100 = 1, b_101 = a) { // note that 'a' has not been gensym'd
  return a_100 + b_101;
}

@disnet, is this an issue in TermExpander?

gabejohnson avatar Apr 13 '17 18:04 gabejohnson

Yeah right around here it looks like the hygiene stuff isn't taking into account initializers.

It needs to apply the function scope in initializers.

Also, I think the current CloneReducer is potentially picking up too many bindings so that should be fixed too.

disnet avatar Apr 14 '17 05:04 disnet