In C++ templates are instantiated with angle brackets vector<int> and the Java and C# languages have adopted the same syntax for their generics.
The creators of D, however, have been quite vocal about the problems that angle brackets bring and they made a new syntax foo!(int) — but I’ve never seen too many details about what problems angle brackets bring, exactly.
One of them was when instantiating a template with another template vector<vector<int>>, which would cause some (older?) compilers to confuse the trailing ‘>>` with the bit-shift or streaming operators. The solution was to insert a space between the two angle brackets, but haven’t compilers become able to parse that syntax, nowadays?
Another problem was when using the greater-than operator foo<3 > 2>. The parser would think that the operator actually closes the template instantiation; the fix was to introduce parentheses foo<(3 > 2)>. But I don’t think there that many cases where you need to do this and, at any rate, I’d rather have to type the extra parentheses when they are needed, instead of introducing new syntax and always having to type the exclamation mark.
What other problems are there with angle brackets that made the D developers create a new syntax?
Of course. But it’s far from trivial. In particular, it prevents you from implementing a clean separation between context-unaware lexer and parser. This is particularly irksome for syntax highlighters and other support tools that need to parse C++, but don’t want/can implement a fully-fledged syntactical analyser.
It makes C++ so much harder to parse that a lot of tools simply won’t bother. This is a net loss for the ecosystem. Put differently: it makes developing a parsing tool much more expensive.
For instance,
ctagsfails for some template definitions, which makes it unusable with our current C++ project. Very annoying.It doesn’t matter how often you need to do this. Your parser still needs to handle this.
D’s decision to drop angle backets was a no-brainer. Any one reason would have sufficed, given that it’s a net benefit.