Stream: compiler development

Topic: scope in `solve`


view this post on Zulip Richard Feldman (Sep 02 2023 at 01:49):

so solve has its own Scope that's distinct from the one we have during canonicalization

view this post on Zulip Richard Feldman (Sep 02 2023 at 01:51):

it looks like entries only ever get added to it via from_def_types

view this post on Zulip Richard Feldman (Sep 02 2023 at 01:52):

which in turn looks like it gets all of its info from constraints that were generated earlier

view this post on Zulip Richard Feldman (Sep 02 2023 at 01:55):

I'm interested in this because during solving we run clone on scope in various places, and I'm wondering if that's really necessary, or if there's some way we could have put the right Variable inside the Let earlier on (e.g. during canonicalization) such that it wouldn't need to be looked up later

view this post on Zulip Richard Feldman (Sep 02 2023 at 01:56):

in other words, it seems like solving is redoing some of the work canonicalization has already done (figuring out what a given lookup refers to in the context of the scope) and it's doing a bunch of hash table cloning in the process

view this post on Zulip Richard Feldman (Sep 02 2023 at 01:57):

so I wonder if we could prevent all that cloning by storing the associated variable right when we create the Lookup constraint itself, for example


Last updated: Jul 06 2025 at 12:14 UTC