
Abominable Function Types (C++) - vmorgulis
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0172r0.html
======
DanielBMarkham
Wow.

I used to love C++. It was my favorite language. I still think fondly of it.

But it's come time to face facts: C++ is like that super-smart friend you knew
in school, the one who was supposed to become the rocket scientist? Instead
he's selling tickets to human-animal sex shows in third-world ghettos. Every
time you look over there you're like "What happened?"

I feel like Obi Wan looking at Anakin "You were the chosen one! You were to
bring balance to the force, not leave it in darkness!"

I'm left wondering: what happens now? Do standards committees just keep
meeting and sticking more and more trinkets on the old horse because that's
what standards committees are supposed to do? There's a ton of C++ code out
there, and C++ was its own super-deep-dive specialty 20 years ago. Now it's a
monster. Is it possible that it ever dies? And if not, do C++ experts become
some kind of uber wizard in the tech community (moreso than they are now)?

It seems like something's gotta give somewhere, and beats me how that's going
to play out.

~~~
vmorgulis
The language is getting better with variadic templates, range-based loops,
auto keyword...

~~~
catnaroek
It's certainly getting more expressive. “Better” is subjective, though - IMO,
there ought to be more convenient ways to achieve everything C++ can do.

~~~
munchbunny
C++ is one of those "does everything" languages. You can do everything from
high level, garbage collected code, down to inlining assembly. The level of
explicit control and setting up your own abstractions is really powerful. It
comes with very high shoot-yourself-in-the-foot potential, but most people
don't accurately assess that cost.

I'm sure other languages or combinations of languages will be able to supplant
C++ eventually, but the combination of inertia and some of C++'s niche
capabilities, plus its extensively optimized compiler support, makes C++ just
a generally hard language to replace.

------
jerf
I believe HN regular munificent has done some solid work on programming
languages that can deal with abominable things:
[https://github.com/munificent/vigil](https://github.com/munificent/vigil)
Perhaps some lessons could be ported out of that into C++.

~~~
vmorgulis
Here is an "Hello, World!" generated by C-Reduce (a compiler bug finder with
genetic algorithm):

    
    
        #include "ostream"
        namespace std {
        basic_ostream cout;
        ios_base::Init x0;
        }
        int main() { std::cout << "Hello"; }
    

The ostream content is very interesting:

[http://blog.regehr.org/archives/1278](http://blog.regehr.org/archives/1278)

Wren is a cool language :-)

------
hendzen
probably not relevant to real world C++ unless you work on libc++, libstdc++,
or your name is either Louis Dionne or Eric Niebler.

~~~
holmak
The article suggests that the discussed behavior is a problem because it does
show up in code that "regular users" have to look at:

> This paper tries to shed some light in the dark corners, and explores
> whether the language can be cleaned up so that good template documentation
> does not drag obscure language-lawyer details into the domain of the regular
> user.

~~~
blub
As far as I can tell from a cursory read, this will affect developers that
want to write very thorough generic code (think boost, STL).

For regular people it's a non-concern. I'd be happy to be corrected if I
misinterpreted something :)

------
jjoonathan
Before I read the article I thought it was going to be a rant about the
absurdly verbose type signatures and/or errors that can result. Here's the
longest one I've seen in the wild -- 8.9kb for the name alone. If you're
bored, I dare you to try to find the opening parenthesis without using Ctrl+F.
Also, if you start reading tokens and wonder what "tetraphilia" is, it's the
love of monsters. Seems appropriate.

[http://www.pastebucket.com/97614](http://www.pastebucket.com/97614)

~~~
vmorgulis
C++ templates are Turing-complete ;)

~~~
jjoonathan
Yeah, I remember when it used to be a joke that C++'s type system would become
turing complete before it got reflection. I don't know if it's more funny or
less funny now that it's actually happened.

In any case, that's what the "in the wild" constraint is for. The name length
limits imposed by the ecosystem probably aren't as interesting as the
creatures you can find swimming in its depths. Probably.

------
twsted
All of this reminds me why I'm not using C++ anymore (a 20-years experience
notwithstanding).

~~~
ableal
Amen. (Once upon a time asked for the purchase of the AT&T cfront tape, and
got it ;-)

To be fair, the author does mention this is not for civilians ...

~~~
vmorgulis
It is free now :-)

[http://www.softwarepreservation.org/projects/c_plus_plus/cfr...](http://www.softwarepreservation.org/projects/c_plus_plus/cfront)

------
jokoon
I'm not scared of the dark anymore, but C++ scares me sometimes. I love the
language, but damn.

------
jason_s
totally lost here -- can someone simplify?

I'm barely up to speed with C++11 and recognize the && move syntax but I've
never seen "using" and don't understand the author's intent.

~~~
vmorgulis
"using" is like "typedef".

With "using", you can define an empty/illegal/abominable function looking like
a pointer to function (usually done with a "typedef").

------
egwynn
Hard to pick between Option 4 and Option 4…

