3 ms·
> 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
by camus2 10y ago
> 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.
- gpderetta 10y agoSure, 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.
- pjmlp 10y agoThat 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.
- prodigal_erik 10y agoReading and writing CPP macros is awful, but it's still not as bad as reading and writing the mind-numbing boilerplate that they replace.
- gpderetta 10y agoA 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.
- pjmlp 10y agoYou 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.