5 ms·
Abominable Function Types (C++)
- twsted 11y agoAll of this reminds me why I'm not using C++ anymore (a 20-years experience notwithstanding).
- ableal 11y agoAmen. (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 11y agoIt is free now :-) http://www.softwarepreservation.org/projects/c_plus_plus/cfront http://www.softwarepreservation.org/projects/c_plus_plus/cfr...
- hendzen 11y agoprobably not relevant to real world C++ unless you work on libc++, libstdc++, or your name is either Louis Dionne or Eric Niebler.
- holmak 11y agoThe 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 11y agoAs 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 :)
- StephanTLavavej 11y agoI updated MSVC's STL to handle these things, and it wasn't nearly as obnoxious as I feared. Almost all of the complexity was centralized.
- DanielBMarkham 11y agoWow. 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 11y agoThe language is getting better with variadic templates, range-based loops, auto keyword...
- catnaroek 11y agoIt's certainly getting more expressive. “Better” is subjective, though - IMO, there ought to be more convenient ways to achieve everything C++ can do.
- vmorgulis 11y ago> IMO, there ought to be more convenient ways to achieve everything C++ can do. Yes, it's my opinion too. C++ remains the fastest language mainly because of the compilers. That's why I still use it. Rust is a challenger. My knowledge of it is very limited but I'm not sure if its improvements will be enough to replace C++.
- catnaroek 11y ago
- jerf 11y agoI 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 11y agoHere 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 :-)
- TerryADavis 11y agoDivine intellect. God says... Tabasco democrat intercept pomegranate's Eurasia summitry's warped biassing clod NW's gender Anchorage's disappointment's jibbed diorama's spinoffs indivisibly onionskin's subtlety quality's Kidd imbalance hosting Cyrano confetti Newark unhurried parachute ordinaries Chesapeake lark's Freeman
- jjoonathan 11y agoBefore 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 11y agoC++ templates are Turing-complete ;)
- jjoonathan 11y agoYeah, 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.
- gfaure 11y agoThat's surely teratophilia, not tetraphilia...
- jason_s 11y agototally 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 11y ago"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").
- jokoon 11y agoI'm not scared of the dark anymore, but C++ scares me sometimes. I love the language, but damn.
- egwynn 11y agoHard to pick between Option 4 and Option 4…