Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Suggestions (take or leave) The various top-level functions all seem out of place. Should they be methods? Should the Fileset be recorded in the Package and File? They are big enough that the extra space would not be noticeable, and it would make them a little easier to use.
The AST is kept minimal, it's essentially just a data structure (but for the Pos(), End() methods). One could add more methods, but the question arises where to stop: When is a method not part of the AST anymore, but a function operating on the AST. The decision - made long ago - was to keep the AST free of such methods. Some of the functionality crept it over time, yet the AST is still just a data structure. Once such functionality becomes methods, one might ask why is printing, type checking, etc. not implemented as methods. It's better to not add all this to the AST. It would be nice if the FileSet would be recorded in the Package and File, but it doesn't solve all use cases (operations om portions of the AST). Also, it doesn't work if an AST contains pieces from different files (which is theoretically possible). I'd be ok with that change as it is backward-compatible (except for the multiple files issue). However, the go/printer would still need the separate FileSet for printing of partial ASTs (decls).
Status changed to Thinking.