News for hackers. Stuff that matters.
Re:Modern C++: 7 Ways to Fake It Until You Have It by ilugaslifk on Tuesday September 04, 2018 @12:10AM (#17906576)
I know this is not quite on topic, but:

Giving some particular construct in your language the official name "Concepts" is just unbelievably fucking atrociously stupid. Inexplicably greedy and needlessly destructive.

Say what you will about Haskell's user-hostile jargon, but even they had the sense to rename a concept that was originally called "Idiom". (now "Applicative")

Re:Modern C++: 7 Ways to Fake It Until You Have It by jholman on Tuesday September 04, 2018 @05:25AM (#17907719)
Is it worse than calling your auto-resizing-sequence type "vector", even though a vector is properly a tuple of (arbitrary) fixed size, and is incomparable with another thing of any other size?

(okay, I guess it might be worse than that)

Re:Modern C++: 7 Ways to Fake It Until You Have It by stochastic_monk on Tuesday September 04, 2018 @12:28PM (#17910239)
Yes, because vector is a library, not part of the core language itself.
Re:Modern C++: 7 Ways to Fake It Until You Have It by Koshkin on Tuesday September 04, 2018 @01:25PM (#17910874)
Well, not just some library. (The 'standard library' should be seen as part of the language.)
Re:Modern C++: 7 Ways to Fake It Until You Have It by stochastic_monk on Tuesday September 04, 2018 @01:41PM (#17911065)
True, but there is a huge difference between a standard library feature and a keyword.
Re:Modern C++: 7 Ways to Fake It Until You Have It by Koshkin on Tuesday September 04, 2018 @06:10PM (#17913287)
Not really... Not in the case of the standard library anyway.
Re:Modern C++: 7 Ways to Fake It Until You Have It by stochastic_monk on Tuesday September 04, 2018 @07:56PM (#17913932)
A keyword is a more core part of the language than the standard library. I could re-implement my own vector. I cannot add my own keyword.
Re:Modern C++: 7 Ways to Fake It Until You Have It by Koshkin on Wednesday September 05, 2018 @09:27AM (#17917692)
No, you cannot/wouldn't reimplement std::vector (not in the sense you are implying).

Compiler writers often extend the language with new keywords.

Re:Modern C++: 7 Ways to Fake It Until You Have It by stochastic_monk on Friday September 07, 2018 @08:01AM (#17933567)
Can you elaborate on the last point? Do you mean things like macros they use, e.g., concepts lite, or __builtin* functions?

I still feel like a standard container is less fundamental than keywords, but I value your perspective.

Re:Modern C++: 7 Ways to Fake It Until You Have It by Koshkin on Friday September 07, 2018 @03:29PM (#17936988)
Yes, built-ins, intrinsics, and extensions.

My original point was simply that std::vector, say, is just as good a "keyword" as any - perhaps, not because you cannot redefine it but because you wouldn't, and if you didn't like what it does, you'd use/implement something else.

Re:Modern C++: 7 Ways to Fake It Until You Have It by AstralStorm on Tuesday September 04, 2018 @04:18AM (#17907461)
Applicative is actually a lying name as it has little to do with Applicative category in maths. (an Arrow does, is a subkind of mathematical applicatives)

It is in the same category of lies like C++ calling its thing a class. (except C++ does not try to have math background)

I prefer a common name to a wrong and confusing name.

Re:Modern C++: 7 Ways to Fake It Until You Have It by stochastic_monk on Tuesday September 04, 2018 @12:29PM (#17910245)
How is a C++ not a class? It’s a class of objects satisfying certain operations and possessing certain attributes.
Re:Modern C++: 7 Ways to Fake It Until You Have It by phendrenad2 on Tuesday September 04, 2018 @03:28AM (#17907247)
As a teen, I was introduced to C++ by a friend (who was trying to get me to stop programming in BASIC). We had a serious bit of confusion for a moment when I couldn't understand where he was watching/attending/accessing these "classes".

Imagine how much more fun we could have had if they had "concepts" in the language back then!

Re:Modern C++: 7 Ways to Fake It Until You Have It by laythea on Tuesday September 04, 2018 @04:09AM (#17907418)
I would argue that sprinkling your C++ version X code with equivalent C++ version Y code commented out is an indication that you may have too much time on your hands :)

Seriously though, in my opinion, it makes the code horrible to read. Comments were invented to provide a programmer to programmer communication method. Stick with 1 C++ version (even that is a lot!). Migrate code slowly or not at all (there is very rarely a solid justification to rewrite working production code), and remember anything you rewrite will need fully tested (and you may still miss some edge cases). Your fellow programmer and team will thank you.

Re:Modern C++: 7 Ways to Fake It Until You Have It by chris_wot on Tuesday September 04, 2018 @12:23AM (#17906625)
Interesting - LibreOffice handled the =delete by setting it as a macro:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=20b...

Other goodies:

SAL_FALLTHROUGH for [[fallthrough]] - see https://opengrok.libreoffice.org/xref/core/include/sal/types...

Re:Modern C++: 7 Ways to Fake It Until You Have It by saagarjha on Monday September 03, 2018 @11:40PM (#17906462)
Three of these are essentially documentation changes. It goes to show that having readable code that makes your intentions explicit is something that C++ has put a focus in recent versions.
Re:Modern C++: 7 Ways to Fake It Until You Have It by blt on Tuesday September 04, 2018 @12:06AM (#17906560)
If you're going to put all that modern c++ in comments, might as well use a macro or special token so you can uncomment them automatically when you switch to a newer compiler.
Re:Modern C++: 7 Ways to Fake It Until You Have It by gruez on Monday September 03, 2018 @11:43PM (#17906478)
>just visit a reference website such as cppreference.com, grab their implementation

This is how you get your employer sued for copyright infringement

Re:Modern C++: 7 Ways to Fake It Until You Have It by roblabla on Monday September 03, 2018 @11:54PM (#17906524)
Said no one ever.

https://en.cppreference.com/w/Cppreference:FAQ

This states that the website's contents are licensed under CC-BY-SA and GFDL, both basically just requiring a link-back to the source. Furthermore, example implementations in reference websites are basically meant to be copy pasted. That's, like, the whole point of their existence.

Re:Modern C++: 7 Ways to Fake It Until You Have It by Someone on Tuesday September 04, 2018 @02:43AM (#17907076)
That’s not just a link-back. Maintaining even one such text fragment across the history of a project already is hard. With every edit of the file, you’ll have to evaluate whether the gist of the original code still is there.

Let’s say somebody copy-pastes half an example somewhere else. Should that have a link back, too?

I think, the smaller the fragment copied, the harder this is.

Re:Modern C++: 7 Ways to Fake It Until You Have It by jakear on Tuesday September 04, 2018 @12:01AM (#17906548)
But in the event you modify it you do have to share those modifications.
Re:Modern C++: 7 Ways to Fake It Until You Have It by chris_wot on Tuesday September 04, 2018 @12:33AM (#17906663)
If you modify it, then it's not going to be the C++11 feature you are emulating.
Re:Modern C++: 7 Ways to Fake It Until You Have It by saagarjha on Monday September 03, 2018 @11:56PM (#17906534)
cppreference is CC-BY-SA.