Open Toxaris opened 9 years ago
On my way home, I thought of another option for interning the names: Since all names are part of the user program, they are all created in the parser, and the parser could intern the name. The necessary state can be kept as Parsec user state.
That means that next to the string, we store an id of type Int with the following property: If and only if the ids of two names are equal, their strings are equal. The Eq and Ord type classes would use the id and never look at the string. The Pretty type class would use the string and never look at the id. We could even use an IntMap for environments.
Currently, most names a string from the user program plus an integer for freshening. We fear that comparing the strings takes too much time.
We discusses some ideas for improvement: