|
Boost Users : |
Subject: Re: [Boost-users] C++ guru required!
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2012-02-27 10:39:44
On 27.02.2012 15:53, Robert Ramey wrote:
> Sebastian Redl wrote:
>> I think this is feasible. I also think it obscures intent, which is
>> why I'm against it.
> It's easy to express intent without adding anything to the language
>
> /* static */ if ....
And if the condition happens not to be a constant expression, and both
branches happen to compile with your particular instantiation of the
template? I usually prefer that my intent is checked by the compiler.
> I'm concerned about adding stuff to the language syntax which
> doesn't really add any functionality. This makes the language
> "bigger" to understand without making the functionality "bigger".
I disagree. The syntax of C++ is weird in some places, but only a minor
part of the "hardness" of C++. The "big" part is semantics: how name
lookup works, especially in templates, how overload resolution and
SFINAE work, those are the things that are hard to understand. The
syntax isn't. The only hard part about the syntax is where syntax had to
jump in for semantics, i.e. dependent name disambiguation with
"typename" and "template".
The part of static if that is hard to understand is what exactly it
means for a branch to be discarded. What exactly is allowed in that
branch? What happens to declarations in the branch, and under what
circumstances am I allowed to use them outside of the branch? (By the
way, the possibility of using declarations from inside on the outside,
which is very useful, is a big reason not to use the normal if, where
this would change semantics dramatically.) These are the things that
aren't even clear yet (note that the current proposal leaves these
things as open questions), and they are going to take a lot of standards
lingo to specify and brainpower to understand.
Putting a "static" in front of (or in my preferred syntax, after) the
"if" is trivial.
> C++ is already way to hard to understand and I don't think
> proposals like this don't reallly help. What this is really about
> is how to incorporate TMP functionality into the language in a way which
> doesn't make the language unreadable.
Yes. That's exactly what this is about. How does making metaprogramming
more readable make the language harder?
> OFF TOPIC
>
> Seems many people are familiar with Andre's talk, I'm curious how many
> here attended "GoingNative"
> -in person
> -via web broadcast
>
Watched it via webcast. 2 days of conference are just not worth the
expense and effort of traveling to the US.
Sebastian
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net