Balance storage and computational costs in class Scope
Created by: wangkuiyi
In class Scope, there are data members:
private:
std::unordered_map<Variable*, std::string> var_to_name_;
std::unordered_map<std::string, std::unique_ptr<Variable>> name_to_var_;
It seems that name_to_var_
is necessary to ensure the uniqueness of variable names in a Scope. But var_to_name_
could be removed if we add Variable::name
.
In this way, we don't need Scope::VariableName
at all.