Interned strings or not

Is interning strings in general good for compiler codebases with which scalable projects can be written?

For example, when there are hundreds of uses of a name in an abstract syntax tree....

I've noticed that the Gleam language implemented in Rust used ecow::EcoString everywhere in the AST, which is a clone-on-write string data type, but is that important?

The key thing about compilers is that they analyze and transform a whole program in many stages, and then they stop. This is what makes string interning fit for their purposes: there is a well-defined point at which the entire set of interned strings can be thrown away (when the compiler exits, or perhaps when all passes that will be using them are done).

If your problem is not shaped like that, then you may need a different solution.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.