rose-lang / rose

Composable autodiff for the interactive web.
https://rosejs.dev
MIT License
22 stars 0 forks source link

Flatten reference scopes #87

Closed samestep closed 1 year ago

samestep commented 1 year ago

Now that we've restricted Refs to parameters and local variables as of #64, there's no real reason for instructions introducing Ref scopes to require their own blocks; we can just introduce the scope in an instruction and then resolve it in another instruction later in the same block. I think I had also previously thought that this would make validation harder in #53, but now I no longer think that's the case; all you need to do is mark reference variables using the same scope as expired once you reach the "resolve" instruction. Anyway, this will make #86 easier because it means that a function's level of nesting can no longer drastically increase during transposition.