Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> yes, I'm a C++ programmer

If you are a C++ programmer then you know that the latest features that were added aim at making C++ programming simpler and easier. Adding something to a language to fix its flaws is not necessarily adding some complexity.



Sure, but the C++ design philosophy is to be the Swiss army chainsaw: it offers tools (often dangerous) for every need.

Go is designed to be a much simpler tool, with the spirit that constraints are liberating.

A simple macro system would maybe fit better the second philosophy than a significantly more complex type system.


That they already have in the form of Go generate, although it brings me memories from MS-DOS Borland C++ before they implemented templates and used preprocessor macros.


A quick look shows that 'go generate' simply allows filtering a file through an external tool. This is a powerful feature but has great setup overhead. Something slightly more integrated with the language (as a distinct compiler pass but still part of the language), with the capability of defining macros inline (and being exportable), and AST based instead of string based would be better.


You can combine it with the AST and template packages, getting half-way there.

In any case, I agree with you, but given the Go's culture I guess that is the closer we will ever get to compile time code generation.


Reading and writing CPP macros is awful, but it's still not as bad as reading and writing the mind-numbing boilerplate that they replace.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: