On 2014-02-16 22:05:10 +0000, Walter Bright said:
"However, I agree that there may well be other reasons to not have them
in Go, such as their simply not being especially useful in day-to-day
programming; but I don't have enough experience with meta-programming
to make such a judgment."
Some years ago, I felt exactly the same way about generics. I have
recently written some very interesting D programs, and I would have
shocked my former self with nearly every function being a template.
I could second this. When you have a strong type system as in D, it
makes sense to have strong meta-programming to avoid rework. My
current project reflects on all modules to look for classes which
inherit from a particular base class -- and then wires those up for
fast serialization and deserialization. This would be impossible to
do at compile time in any other language, and impossible in most
languages, and requiring slow run-time reflection in others.
I've found a use for something similar to this in most projects I've
done lately. In C# I use Linq Expressions to compile anonymous
delegates at runtime to do something similar -- but the code is a
nightmare.
-S