While having generics as part of the language and doing the code-gen in the compiler has definite advantages (ease of use and potentially better optimization of the generated code), doing it as a separate tool *also* has advantages. For example, this way no one is bound to whatever notion of generics will eventually be built into the language. Because it *will* have limitations and provide a trade-off. With separate tooling outside the language, people can make their own tradeoff.
For example, yes, you can do template-like code generation at compile time. But you could also box values in interface{} and have a tool that verifies your desired notion of type-saftey statically. It's up to you - whatever makes more sense for your use case. Honestly, right now I'd prefer good and easy to use meta-programming tools for go. If I can write my own type-checks or code-gen to be run on a go build, it enables far more powerful tools than generics alone… (yes, it also has drawbacks. I'm aware). On Sun, Aug 27, 2017 at 5:08 PM, <prades.m...@gmail.com> wrote: > > That's how C++ started. > > And that's also why C++ is the ugly monster than it is today; with a > design that wasn't quite thought thoroughly. Talking about C++ like it's an > example to follow is just preposterous. > > Le dimanche 27 août 2017 16:25:54 UTC+2, Jan Mercl a écrit : >> >> And there's nothing wrong in it. That's how C++ started. Codegen allows >> for easier protoyping throwaway experiments. Writing a full blown compiler >> and realizing afterwards a better language/feature design costs probably >> much more work. >> >> On Sun, Aug 27, 2017, 15:55 <prade...@gmail.com> wrote: >> >>> > Codegen can do 100% of what any compiler can do. >>> >>> Yes and it is called doing the compiler's job in place of it. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "golang-nuts" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to golang-nuts...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> >> -j >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.