News for hackers. Stuff that matters.
Re:Golang data structures by jshen on Saturday July 04, 2015 @02:10AM (#9829410)
> or you rely on some sort of code generation approach.

Exactly.

Re:Golang data structures by fauigerzigerk on Saturday July 04, 2015 @04:07AM (#9829605)
Here's an idea: How about a code generator that interprets special syntax we put into source files? The code generator would run before every compile and its output would be fed straight into the compiler. An apt name might be CPP -- compile preprocessor.

It might be a bit difficult to predict what the input to the compiler actually looks like after CPP has done its job. So we could restrict the kinds of things that CPP can do to make it more predictable. Let's say CPP can only substitute symbols in places where types are asked for...

Re:Golang data structures by enneff on Saturday July 04, 2015 @04:54AM (#9829670)
So do it. If it's a great success, it might end up in the language. (Seriously.)
Re:Golang data structures by jshen on Monday July 06, 2015 @03:49PM (#9841741)
There are languages that have what you want. Why not use them?