OSNews article about C++09 degenerates into C++ vs. D discussion
Don Clugston
dac at nospam.com.au
Sat Nov 25 07:23:39 PST 2006
Steve Horne wrote:
> On Thu, 23 Nov 2006 01:52:01 +0900, Bill Baxter <wbaxter at gmail.com>
> wrote:
>
>> Don Clugston wrote:
>>
>>> Well, now that we have IFTI and tuples(!) I seriously don't think any
>>> template affectionado is likely to evaluate D negatively in that regard.
>>> Once the word gets around, I think there'll be a lot of defections.
>> Metaprogramming in C++ is OOP in C all over again. Sure you can do it,
>> but... they definitely didn't have that in mind when they designed the
>> language, so it ain't gonna be pretty.
>
> I saw someone asking about the VC++ __if_exists and something like
> static if in a GCC discussion once, about whether GCC would support
> it. The reply was that template metaprogramming creates unmaintainable
> messes and shouldn't be encouraged.
>
> And I thought to myself - but metaprogramming isn't going away,
> presumably because it is needed. And most of the reason for the mess
> is that conditional parts need to be handled using specialisation
> rather than simple conditionals. So why not make life simpler and more
> maintainable?
Exactly. In C++ metaprogramming, the only control structure you have is:
(x==CONST_VALUE) ? func1() : func2()
where x must be an integer. No wonder C++ metaprogramming code is so
disgusting. I've been amazed at how D metaprogramming on strings can
sometimes be shorter than the equivalent C++ runtime code !
>
> I was going to say so, but that would have meant registering and blah
> blah, and I put it off to the later that never happens. Which is a
> shame. It needed saying.
>
More information about the Digitalmars-d
mailing list