Stream: t-compiler/wg-rls-2.0

Topic: Structuring name resolutino

matklad (Dec 20 2019 at 15:41, on Zulip):

I've been doing various refactorings around our name res and noticed that handling of globs and legacy macros works rougthly like this:

for module in modules.iter() {

That is, when doing fixed-point shenanigans we simultaneously iterate and mutate scopes. This obviously doesn't work out due to this annoying borrow checker, so we insert a bunch of clones in various places. I wonder if that's a sign that we need some more explicit work-list style approach.

Basically, we split each iteration into two parts:

fn compute_diff(&self) -> Diff;
fn apply_diff(&mut self, diff: Diff);

That way, we solve the ailasing problem, and maybe also make the code clearer, as iterations become indipendent of each other.

Granted, the Diff thing would probably be isomorphic to the cloning we do today, but it will be an explicit struct one can eprintln!("{:?}"), instead of a number of local .clones all other the place

Florian Diebold (Dec 20 2019 at 15:47, on Zulip):

sounds like a good idea to me

Florian Diebold (Dec 20 2019 at 15:54, on Zulip):

I always like 'reifying' things ;)

Last update: Sep 18 2020 at 20:45UTC