Boost logo

Boost :

Subject: Re: [boost] C++11 Metaprogramming
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2012-04-06 06:26:23

> On 06/04/12 09:04, Andrzej Krzemienski wrote:
>>> And this is the worst part: I forgot the
>> "typename". Having to type this "typename" is really terrible and just
>> scares off many people. If you do not mind it, it only means that you got
>> used to it; but people should not be forced to get used to too many
>> gotchas.
> The language requires to specify whenever dependent names in template
> contexts are anything else than values (i.e. types or templates).
> There is no substitute for learning the basics of the language. This is
> not a gotcha, just normal usage of templates.

Clearly, if you do not find requiring of the programmers to type this
"typename" in these places even slightly wrong, you will not appreciate
alias templates as a useful addition to meta-programming. Also, if you did
a lot of advanced meta-programming, you have probably mastered the rules of
template syntax, and find it difficult to sympathize with those that did
not master the subject.

But looking at it from the fresh programmer's perspective, the fact that
the language requires "to specify whenever dependent names in template
contexts are anything else than values" means that the language is not
friendly to the fresh programmers (I understand that there are good reasons
for requiring this, but still...).

Based on the Wkipedia's definition of "gotcha" I interpret this typename as
one. "In programming, a gotcha is a feature of a system, a program or a
programming language that works in the way it is documented but is
counter-intuitive and almost invites mistakes because it is both enticingly
easy to invoke and completely unexpected and/or unreasonable in its
outcome." It (the usage of typename) only appears as "normal usage" after
you are past the stage of surprise. The context of your reply seems to
imply that whoever finds this behavior surprising is guilty of not having
acquired the basics of the language. Unless I misunderstood you, I think
this position is a bit unfair.


Boost list run by bdawes at, gregod at, cpdaniel at, john at