JSAbrahams / mamba

🐍 The Mamba programming language, because we care about safety
MIT License
85 stars 3 forks source link

ConstrBuilder in check treated both as immutable and mutable argument #385

Closed JSAbrahams closed 1 year ago

JSAbrahams commented 1 year ago

Summary of current issue

It's a bit odd that we in the check stage both:

It is sloppy to use both. Noticed this when writing the constraint_cases function in #382

Proposed change

It would be detrimental to performance I think to create a copy each time. So I would propose that we modify the Constrained type to only include the environment. The environment should be immutable as we don't want any chance of contamination. In the case of the ConstrBuilder, it internally maintains several distinct sets of constraints to prevent contaminiation.

tl;dr: