"Jonathan M Davis" <jmdavisp...@gmx.com> wrote in message news:mailman.1217.1322715788.24802.digitalmar...@puremagic.com... > On Wednesday, November 30, 2011 22:32:51 Abrahm wrote: >> "Jesse Phillips" <jessekphillip...@gmail.com> wrote in message >> news:jb6qfv$1kut$1...@digitalmars.com... >> >> > What bearophile was referring to was the use of templates is common. >> >> Are you sure about that? What say you Bear? >> >> > D's >> > templates have the advantage of being easier on the eyes and more >> > powerful (with the inclusion of 'static if' in the language). >> >> Having "come from" C++land, and knowing what some people do with it, >> making it EASIER to apply templates does not seem necessarily a good >> thing to me. (Ref: template metaprogramming). That said, does your >> statement above about D's template machinery being "powerful" etc., >> mean >> "it's easier to do template metaprogramming in D"? If so, I, >> personally, >> do not find that any asset at all (though I know some surely will, for >> there have been books written on that "abhorrence"). > > Andrei Alexadrescu, the author of Modern C++ (_the_ book on template > metaprogramming), is one of the leaders in the D community.
He used to be a C++ guy though. I know, because one of his books. He couldn't handle C++, so he moved to D. Noted. ;) > There is no > question that D's templates are intended to be able to do powerful > metaprogramming. "powerful" is a weasel word or something similar. > However, much of what would be truly disgusting in C++ is > incredibly simple in D such that it isn't an abhorrence at all. Ha! Optimizing bad practice does not good practice make. > You don't have > to constantly fight templates I never have, and I use them. > to be able to do anything fancy. There ya go. You need "something fancy", I don't. You want all the knobs and buttons on the front of the audio equipment, even a programming language to make sense of it, while I would rather just listen to some music. So, no need to try and sell me on "fancy". "Fancy" is a bad thing if I am doing the critiquing (of a PL, not of a ... nevermind!). > Instead, the > resulting code is much more intuitive and maintainable. So, the missing book is: "Deciphering Crap Code". Hmm? > > However, aside from template constraints, the primary use of templates > in D > (at least in the standard library) is generally related to simply > making > functions more generic, not trying to do excessively complicated stuff. Noted: YOU noted that as AN ASIDE. Speaks volumes. > > Templates in D are absolutely fantastic in comparison to C++'s > templates and > are a _major_ boon IMHO. Okie dokie then. We won't be engaging much, I can fortell already. > > http://stackoverflow.com/questions/7300298/metaprogramming-in-c-and-in-d > WRONG answer Dave.