Yep, good thread! Two ideas came to me while reading it: 1. Scalac includes AST node constructors that take symbols as arguments, and these are much safer to use after type checking is complete. Would it be reasonable to have a flag in the compiler such that, once type checking is complete, you can *only* use the symboly constructors? I know I've had a lot of trouble writing scalac code due to ASTs that are badly typed. If you use the symbol-based constructors, they tend to add the correct types automatically.
2. I seem to recall a fair amount of code in the compiler that does a check for whether or not erasure has passed. If that's still the case, then it might actually simplify things to have a separate AST for after erasure. How much code is really used polymorphically against both pre- and post-erasure ASTs? How much of that code does not branch based on whether erasure has happened?
Just ideas. Lex
Two ideas came to me while reading it:
1. Scalac includes AST node constructors that take symbols as arguments, and these are much safer to use after type checking is complete. Would it be reasonable to have a flag in the compiler such that, once type checking is complete, you can *only* use the symboly constructors? I know I've had a lot of trouble writing scalac code due to ASTs that are badly typed. If you use the symbol-based constructors, they tend to add the correct types automatically.
2. I seem to recall a fair amount of code in the compiler that does a check for whether or not erasure has passed. If that's still the case, then it might actually simplify things to have a separate AST for after erasure. How much code is really used polymorphically against both pre- and post-erasure ASTs? How much of that code does not branch based on whether erasure has happened?
Just ideas.
Lex