4 ms·
> It’s difficult to generate Go code automatically. But, I must say, I do really like that Go makes the AST a first-class citizen and a core part of the standa
by randomdata 9y ago
> It’s difficult to generate Go code automatically.
But, I must say, I do really like that Go makes the AST a first-class citizen and a core part of the standard library. While not strictly a Go thing, in the languages I usually find myself programming in you have to rely on third-party implementations of varying degrees of quality or, even more common from what I see in the wild, messy string building. Being able to focus on generating the tree and have the built-in printer generate the code in the format that Go users expect is a much nicer way to generate code.
- lazyjones 9y ago> I do really like that Go makes the AST a first-class citizen and a core part of the standard library. Seconded. But I wish they would go one step further and make its compilation / code generation a first-class citizen too, including dynamic loading of generated code.
- bunderbunder 9y agoI wonder if this is really hard to do in a way that works on arbitrary platforms. The .NET framework has had it for a while, but it got removed in .NET Core.