On Sunday, 14 September 2014 at 01:48:51 UTC, Andrei Alexandrescu
wrote:
On 9/13/14, 3:25 PM, Walter Bright wrote:
On 9/13/2014 1:10 PM, eles wrote:
This presentation:
https://parasol.tamu.edu/people/bs/622-GP/C++14TAMU.pdf
He criticizes C99 VLA (slide 24) as being "an abomination"
But the surprise comes at the end (slide 57), where he also
criticizes... the
static if as being "a total abomination". Well, this is D, I
told myself.
Are those points valid?:
static if is a total abomination
• Unstructured, can do everything (just like goto)
• Complicates static analysis (AST-based tools get hard to
write)
• Blocks the path for concepts
• Specifies how things are done (implementation)
• Is three slightly different “ifs” using a common syntax
• Redefines the meaning of common notation (such as { ... })
Yeah, well, we have many years of experience with "static if"
and no
apocalypse has yet happened.
The proposal:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3329.pdf
Bjarne's rebuttal:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3613.pdf
D offers strong evidence that static if is an enormously useful
construct. I have all respect for Bjarne as language designer,
researcher, and engineer, but the evidence suggest he called
this wrong. He is right that static if would have derailed work
on concepts, because it simply exposes them as missing the
point. From that perspective N3613 is entirely politically
motivated (almost all technical arguments are bogus, and the
reasonable ones are exaggerated by the fallacy of vivid
argument).
To be fair, the way it is implemented right now is a hack, and it
is not C++ standard grade definition. Not even remotely close.
Trying to implement that in a more rigorous way led me to some
"Google have no idea what you are talking about" moment. It is
fairly clear so far that I'm either very bad at research, or that
approach necessary to handle static if like construct in
languages is absolutely unresearched.
Relevant link summarizing the whole experience:
http://phdcomics.com/comics/archive.php?comicid=1727