StrongerXi / soc

Compiler for a subset of OCaml
1 stars 0 forks source link

Refactor namers #42

Closed StrongerXi closed 3 years ago

StrongerXi commented 3 years ago

Tyvar_namer and Var_namer contain a suspicious amount of duplications.

They also serve similar purposes in nature -- renaming, so we can generate new unique string names, in whatever namespace (e.g., variable or type variable).

This PR puts them together into a Namer module and put it under the common directory.

Although we can abstract over the two renaming process even further (check out how they fold over expressions), but I think that's borderline over-abstraction, since they aren't exactly the same. I'll come back to this later if I'm proven wrong, which is likely.