effekt icon indicating copy to clipboard operation
effekt copied to clipboard

Fix namer to support recursive variable declarations

Open b-studios opened this issue 2 years ago • 2 comments

See @phischu's talk at Shonan.

The type of mutable variables cannot mention the variable itself. This should be allowed.

b-studios avatar Sep 26 '23 02:09 b-studios

@phischu could you add the example from your talk here?

b-studios avatar Jan 28 '24 12:01 b-studios

The following program typechecks:

def main() = {
  var x = box { () => 3 };
  x = box { () => x() };
  x()
}

The type of x is inferred to be () => Int at {x}. However, when I try to annotate this type:

def main() = {
  var x: () => Int at {x} = box { () => 3 };
  x = box { () => x() };
  x()
}

The program is rejected with "Could not resolve capture x".

phischu avatar Jan 29 '24 11:01 phischu