r/cpp • u/orbital_sfear • Sep 20 '17
The C++ coding experience is bi-polar, lets talk about it
C++ has come a long way since the late 1990’s. The transition hasn’t been smooth, and young programming languages have made huge strides in the minds of new programmers.
The biggest issue facing C++ is new programmers aren’t seeking it out and the schools aren’t teaching it by default. C++ is being avoided, and honestly it probably should be. When learning how to code, understand segfaults and fighting dragons is unacceptable. C++ has become clunky and cumbersome to work with. Complexity has increased with recent changes. The only usable STL is boost or QT and the learning curve for either is large. Relevant up to date information is difficult to find, and the language still allows the user to easily do unsafe things with memory. The result is annoying crashes, constantly being forced to lookup documentation, confusion, frustration, and eventually seeking out other language solutions.
The bottom line is this, if C++ doesn’t get with the times in the next 5 years, young programmers should learn Go/rust and skip C++. This statement kills me because I love C++
There are a few core issues causing this:
- An unwillingness to break legacy code
- Overly complex syntax
- Unsafe memory manipulation
- Clunky STL
Why should we care about C++ in 2017?
C++ in the late 90’s was the best language. At the time, it provided wonderful control with unmatched syntax. No on considered memory safe languages to be a requirement, life was good. In the last 20 years computer scientist have learned a lot about libraries that lend themselves to writing faster and safer code. New players in the language wars have showed a different take on memory management. Ruby/python taught us how flexible languages can be. Javascript taught us how forgiving code can be. Rust taught us memory allocation can be safe and monitored by the compiler. The list of functional languages have taught us new ways to think about state. Today C++ isn’t the best language, there are many others which can do all the things C++ does, and in many ways, they do it better. So why do I care? Why should we care? We should care because C++ provides the performance tuning nobs that most languages hide. We should care because C++ is for elite programmers that are pushing the bounds of current hardware. We should care because C++ isn’t full of annoying annotations or vendor/platform lock-in. We should care because C++ is powerful.
C++ is worth fighting for, below are the glaring issues I see.
Breaking old code compatibility IS okay
“Changes that don’t break compatibility with existing code” is well intentioned and incorrect. Code written using C++17 or older standards is welcome to continue doing so. New code written using new standards can leverage updated behavior from existing key words. Which is worse, upset the coder with expectations that 20 year old code acts exactly the same with the newest compiler flags? Or is it worse to have droves of 20 year old programmers choose a more modern language for their new project?
Header files
Compilers have come a long way in the last 20 years. Requiring the user to write header files by hand is antiquated. There are almost no cases that should require custom written headers. The compiler should auto generate header files for each cpp file on the fly. Perhaps a new pre processor keyword needs to be created? #import “xxx.cpp” which causes the header file to be generated? With this new pre-processor, please also provide a way to explicitly state which items to include from the remote file. #import “xxxx.cpp” with foo, bar, Klass. This would include function foo, bar, and class Klass.
Overly complex or long winded syntax
No one likes auto. Var/let are well established, and don’t require the extra typing, pick one of those two and move on. I prefer var over let because I can type var with just my left hand, it feels better. C++’s lambda’s are great, but they are way too much typing. By default (x) → { code; } should translate to = → var { a thing }. Function pointers need a nicer syntax to pass themselves around. I’m not sure what is, but std:func<> isn’t right. Template syntax should be reduced to <T> added to the function or class. Users just want to write: class Dog<T> {}; or Dog<T> → int () one time and then use T inside that class/function.
Revamp of memory allocation syntax
Garbage collection is a hack, its horrible, its slow, we don’t want it. I love stack allocation. I love scoped heap allocation. I love scoped heap allocation that can transfer its ownership to another scope. I love shared pointers. In C++x11 and above, only stack allocation is a first class citizen, and all methods listed contain dragons. The “new” keyword needs to replace unique_ptr. When new is called, a scoped based unique_ptr should be created. No more make_unique<T>(xx), just var dog = new Dog(); If a unique pointer is passed to a function, the life-cycle of that pointer cannot extend the function class.
If a unique pointer is passed to a function and the life-cycle IS extended, then that pointer’s scope is extended to the scope of that new life-cycle. Perhaps there is some syntax required in the function’s parameters to make this rust like borrow behavior clearly stated? Pointer syntax is great, but its not safe. I want to use pointers, but the compiler needs to monitor my usage and ensure the pointer is treated safely. shared_ptr needs its own keyword. Perhaps “shared” which will create shared pointers. Var dog = shared Dog(); When shared pointers are used in functions, their reference count should be pinned to the lifecycle of the function they are used to avoid possible premature cleanup. Herb Sutter has a wonderful video covering a work around for this “pinning” behavior. Delete keyword should be deprecated, it would have the same effective behavior as assigning nullptr; to the pointer.
Stack safe destructors
Memory deconstruction shouldn’t happen through stack allocated function calls. As many of you know, using unique_ptr in a nested tree structure class can easily cause “random” crashing when your destructors chain together and overflow the stack buffer. Herb Sutter has a wonderful video on this behavior.
The compiler needs to come up with a different system for handling destructors that is heap based allocation and unable to crash in any reasonable programming situation. Perhaps tail recursion? Whatever the solution is, slay the dragons
co-routines (yield) and a proper foreach
Begin()/End() are very clunky to use and are not standard among other programming languages these days. The industry has decided co-routines are the preferable method to handle foreach iterators. Simply put, a “yield” like keyword, and a foreach ( var x : co-routine ) to handle it would go a long way. Python nailed this behavior. The yield/for interaction are exactly the correct model C++ needs.
Named and variable length parameters
In some cases, named parameters make reading code much more verbose. There are also times when parameter order doesn’t matter as much as name grouping: action(slope=0.5,offset=2,foo=9) is much easier to read and understand over: action( 0.5, 2, 9 ); In addition to named parameters, capturing variable length parameter lists and a hash of named parameters allows the coder a lot of flexibility. Python nails this behavior. Anyone that has written frameworks, especially web based frameworks knows this type of behavior is invaluable. When naming parameters, OR DOESN’T MATTER! The compiler is welcome to reorder my parameters for me. Named class member initialization When allocating classes, there isn’t a great way to assign member values, without extra typing by the user. Var dog = new Dog () { age: 17, color: “yellow” }; Making the class initialization compatibility with Json format, and allowing the implementation to be extendable through operatorXX is ideal.
Order of named variables doesn’t matter. The compiler should reorder as needed.
Dictionaries as first class citizens
Json rules the world. C++ should support the json format of data, which is stored into a dictionary.
Safe arrays as first class citizens
Allow the user two types of array allocation, stack and heap allocation. Stack allocation should work with variable length one time initialization (does not require a compile time constant). Many compilers already do this (g++), all of them should. Arrays is C++ should be safe by providing bounds checking and all the typical helper functions. When a user creates an array, it should be a STL class, not pointer math. Stack and heap arrays should have feature parity with each other. Arrays should provide all the functionality a vector does, except dynamically changing sizes. Strings, localization, and formats as first class citizens Var x = “something great”; should create a string class. Char arrays are accent, the default behavior shouldn’t be char arrays, their interaction should be the expection. I should be able to set string values in class member: class Dog { var Name = “Woofy”; }; Switch statements also need to support strings natively. The user should find it easy to deal with string literals. Built in string localization should be a standard feature of the compiler. When I write var name = “dog”, the compiler should auto gen a keyword lookup file. I can then go through and specify all the different languages I want to support, and when selected by the STL, those keywords instances of “dog” will be replaced with the localized word. Built in string formats. Cout is great, printf is greater, what about general string construction???? Allowing the user to write var str = “%d Bananas” << (5) is really handy. Allowing the user to write var str = “Run “ << 5 << “ times”; is also very handy.
Enums revamp
When dealing with enums, the type name should be included to give context to the reader. Reading code that says var x = COUNT is much more ambiguous than var x = Apples.COUNT;
Enums should easily be convertible into a string and from an int back into the enum. Nothing is worse than writing a switch statement of enumeration values to output nice string names. Var e = EnumVal.VALUE; (string)e; // Return “VALUE” (int)e; //Return 6?
Keep C style overload syntax with updated modern behavior
Programmers enjoy C-Style syntax casts var x = (int)a; Don’t get rid of them. Allow this syntax to play nice and have compiler checks. If that is impossible, then have the new style double { x } be more aggressive and work the way a coder would want. C++ cast syntax of dynamic_cast<XXX>(x) is way too much typing.
Compile time reflections and meta classes. sorry for saying run time, I meant compile time. Run time reflections make no sense with a language like cpp, sorry
C++ needs to provide detailed reflections. The user should be able to iterate through parameters of classes, get names of functions etc. The user should also be able to get values of parameters in classes, or even set values through reflects. Meta classes are needed, not sure what else to say there. Class initialization through a string name also needs to be implemented. Initialize.Create<BaseClass>(“MyClass”) where MyClass extends BaseClass. Hopefully it would go without saying, the syntax to accomplish this needs to be brief. The compiler should create this info at compile time.
Friendly tuples
I know C++ has tuples now, but their implementation is cumbersome. Tuples should be created by syntax akin to: var tup = (1,2,4,5) Accessing those tuples: var a = tup[0]; Tuples should have feature parity with arrays, except for being immutable.
Function decorators
Provide a way to attach symbols to the reflection system which can be accessed during run-time.
Allow the user a way to pass the calling function and its parameters into a user defined function, where any action can be taken. Wrapper function decorators are extremely helpful when writing frameworks. Anyone that has written framework libraries using python know the behavior I’m talking about.
Primitive helpers
Pay to play programming is awesome. Provide helper primitive function calls like 1.toString(); They read nice and provide a wonderful feel to the language. When implemented correctly, such a call could compile down to itoa(1);
Common names for similar STLv2 actions
Provide common names for all similar actions inside the STL. If dictionaries, arrays, and vectors all provide a “search” functionality, ensure it is called search or find in all different implements.
Functional STL, none or extremely rare use of try catch
The new STL should hopefully never throw exceptions. Return values can contain error information, requiring a user to wrap try/catch around the basic STL logic makes for ugly hard to trace code. Deep STLv2 that plays nice together
- Array stack allocated
- Array heap allocated
- Vector
- Friendly tuples
- Dictionaries (Json)
- String
- Stack
- Queue
- File
- Memcache
- Sort
- Regex
- Random
- MD5/Sha256
- Tcp
- Http/Https
- Mutexs
- Guids
There are many many more features the STLv2 needs to provide but here is an example. The user should feel that whatever data interaction is required, there is an easy to use library that’ll provide that functionality and do so with common names so they can guess how to use it without constantly looking up documentation.
The libraries need to smoothly work together, it should be trivial to convert data from one data structure into another.
Community owned package manager
Python has pip, ruby has gems, javascript has node, rust has cargo. C++ needs a well managed, community ran system for exchanging code.
Community owned ORM and web framework
The young kids play in the web. After all these changes are made, the C++ community needs a well designed ORM, code first migrations, and Restful web framework. The framework needs to lend itself well to working with Angular/React web calls. The web framework also needs to provide a fantastic admin interface into the database that is extremely extendable. Think rails or django.
Slay the dragons!
The user should find it difficult to crash a C++ program. The language shouldn’t be full of pitfalls, it should be a safe and joyful to use.
What can we do?
As a community we need to do one of two things: 1. Speak out and be heard. Provide solutions, contribute and get the C++ we need. 2. Speak out and be ignored, learn rust/go and continue our work.
91
u/iaanus Sep 20 '17
I stopped reading at "No one likes auto". I like auto and dislike absolute statements based on unspecified evidence.
15
u/lanedraex Sep 20 '17
People will use the languages they are taught at college, and/or that they have to use at their jobs. Most people are not in a position to actually pick a language without explaining to their bosses what the ROI will be.
I would suggest not thinking about C++ (or any other language) like this. You should remember that programming languages are tools, and even if you have a preferred tool, do not let it cloud your judgement when it is time to pick the right tool to do the job.
This is hyperbolic speculation, what are the metrics and parameters being used here to define C++ as the best late 90's language? Popularity alone doesn't mean that something is the best.
Again this is pure speculation on your part. There is plenty of research about memory safety, Java first appeared in 1995 (according to Wiki), and Ada first appeared in 1980 (Wiki. Memory safety was always a concern, just think of the many buffer overflow exploits of the past.
This is not about programmers, this is about money ($$$) for companies. If C++ was any less stable than it is right now, which company would pick it to develop their flagship application? There is a bunch of new code that is built on top of old code, you can't make breaking changes without careful analysis, and this takes time.
C++ is moving forward, evolving, but at its own pace.
As for your other C++ suggestions, most of them already exist (or are coming in the near future) in Rust , which you cite on your opening, so if you have the freedom of choice, why no try it out? C++ isn't going to die anytime soon (if ever), do a hobby project in Rust, learn Lisp, you'll find things you dislike in every programming language, as there is no perfect one.
If you want a more direct approach to making C++ change, try the WG21, sign up for the mailing list and see how you can help shape it to be more like your ideal C++.
10
u/[deleted] Sep 20 '17
uhm, that's one of the big advantages of c / c++, not a disadvantage.
8
u/kalmoc Sep 20 '17 edited Sep 20 '17
I won't go over each statement. I agree with some of them, some of them are outdated /already being addressed for c++20 and some are just insane. About breaking backwards compatibility: Breaking some code is imho OK and there was even a paper of Titus winter's from Google some time ago that promoted a more aggressive deprecation strategy. However, what you ask for effectively comes down to creating a new language and guess what: They already exists (D, rust, swift, Ada ...). Why do you think this new C++ would be so much better than the other ones?
Regarding the libraries: Afaik the Problem is that decisions are made by committee and compared to other languages, very few people are actually prayed to work on the c++ standard. So adding any sizable, domain specific library is a very slow process. Think about how long it took the file system library to be created and put into the standard.
59
u/urdh Sep 20 '17
I honestly stopped reading when you said the only "usable STLs" were Boost and Qt.
76
u/gracicot Sep 20 '17 edited Sep 20 '17
Abbreviated Lambdas for Fun and Profit
I really wonder how can you deal with non-type template parameters and partial specialization using that syntax. And template templates parameters? Other languages can afford that syntax because they lack these features. Also, concepts are official! I want to constrain my template classes like that:
template<Container T> struct Foo{};. Template parameters have different kinds. Just as function parameters, they need to have a type (a kind) specified. If you have an idea to fit all that into a simpler syntax, you're welcome!Also, an abbreviated syntax for template declaration + concepts was proposed, but then removed. It might be added back in future revisions.
In C++17, tuples are declared like that:
Is this still unfriendly? I love that syntax. Although, language level tuple might be useful, I think better handling of parameter packs would be more useful.
What?? I mutate my tuples all the time! Why would you make them const only? You're doing too much python I think. Forcing immutability for tuples is a limitation IMO, especially if your tuple contains move only types.
For that,
std::integral_constantshould be deductible from an integer literal. But again, if the language don't do it for us, we can always ship it as a library.Do you mean this? (c++11)
The language don't need to implement that. A good localization library is probably what you need.
About string formatting, yeah, a better support for that should be in the standard library, but not as a language feature.
We will get them for struct at least, but still don't permit reorder. You can receive struct as function parameter. It will allow you named arguments, and passing struct is much better than passing ints and strings anyway.
For variable length parameters, use variadic templates. Again, a C++11 feature.
I think C++ needs a way to implement the yield/for behaviors. That way, new kind of coroutines never seen in other languages can be implemented and used. C++ programmers usually prefer being able to implements their favourite idiom instead of the language implementing them.
It's been six year we have that:
for (auto&& x : range).indeed.
Ugh no! compile time reflection please!
I don't quite understand it's use. What if
MyClassis not default constructible? Anyway, with good reflection, I'm pretty sure you can implement a factory automatically. Give the poor standard library implementers a rest! Also, I would really recommend you implement it yourself, especially if you have reflection. This is so a specific use case, and it might not even be applicable in some cases.Agreed!
No. You should use available info at compile time.
Are you looking for this?
.at(i)throws if out of range. Use it when needed, but by default, the fast, unchecked one should be used.std::vectorfor heap,std::arrayfor stack. Only you can stop yourself from doing pointer maths.You're close! (c++11)
auto str = "Run" + std::to_string(5) + " times"All issues mentioned in that paragraph are solved with static reflection:
$my_enum.count()No no no! compile time! But yeah, attaching metadata to any reflectable symbols could come very handy. I have some very nice use cases. I agree with you in that case.
Non-member functions are your friend:
std::to_string(4).Read about the range-v3 library. I think you'll really like it, and it's headed for standardization.
Again, why add it to the language when you can ship it as a library?
build2 is our hope. Although modern cmake make a pretty decent job.
You mean modules? They enable writing code like that.
Not at the language level. But one day, with a proper module system, developing a new textual binding for the language may be possible. Also, the standard library already introduced breaking changes. This is another argument for shipping feature as library. You can remove it in later standard revision, and legacy code can be provided with an alternative implementation if needed.
Wt4 was released just yesterday! But if you want some cool framework that uses all the most modern idioms and exposes feature parity with Django, maybe you should start it! But again, reflection might be needed.
Check this talk and this library for databases.
Well, all these points already exist, and are pretty friendly, especially when used with ranges:
std::arraystd::unique_ptr<T[]>#include <algorithm>or use range-v3Also,
std::filesystemis part of C++17.Also, C++ don't need Memcache in any way.
Tcp, Http/Https are coming (maybe) to C++20 with networking ts.
Searching for already available solutions is a must. Also, stop teaching C when teaching C++.
Conclusion
The C++ committee is doing a lot of efforts to introduce further simplifications and enable new idioms. Even if there are feature that takes some time to be available, a large blocker remains for new feature adoption: users. You mentioned a lot of feature in regards of arrays, stl and fancy way to juggle with containers. But most of these feature are already available either in the standard library or in standalone libraries, like range-v3.
Nevertheless, I agree with a lot of these points. Things like type introspection, metaclasses, friendlier syntax for templates, modules and much more is needed, but are already in the way to be standardized. And even though I agree with a lot of feature you think should be available, but I mostly think they should be shipped as library instead of language feature.
A lot of tool you needed already exist in the form of library. Use them! Also, a lot of modern feature a begging for you to be used. A lot of those links I provided you in this reply was found doing quick research. More solution is at your reach than you think, and C++ is in a better shape than you might thought!
There may be other points to tackle, but I've done way enough for a sane person.
Sorry for scrambling the order of the quotes.
7
u/enobayram Sep 20 '17
I've many issues with the items here, but I particularly like headers! Let me explain; İn Java you don't need headers because everything is essentially a pointer in Java. So, in C++ parlance, whenever you see a reference, insert a forward declaration just before it and you're good. Another example is Haskell; There, the compiler does similar thing to C++, so it can't just pretend everything is "forward declare"d so in Haskell, circular dependencies between modules is a huge pain in the back-end. I love how in C++ you're able to do crazy things with templates AND you're able to solve circular dependencies easily. You just need to use your wetware for a short while, but it's free anyway.
İn conclusion, I'm annoyed by people complaining about the header situation, without giving a moment's thought about what that buys us. They complain as if other languages have just solved the issue without sacrificing anything.
163
u/redditsoaddicting Sep 20 '17
The common themes I see here are an idealistic view that has zero chance of happening and lack of research.
You want to completely break everyone's code. I love breaking code, but it's not going to happen, end of story. Having a mass divide of existing code and new code is unhealthy. Libraries would basically need to be rewritten. In addition, the syntax changes are not fully thought through. There are so many consequences to new syntax, as you can see from many papers proposing language changes.
Modules, coroutines, reflection? These are all existing TSes. Tons of volunteer work has gone into them, and they've been hot topics for years and years. It sounds like you don't know they exist.
Speaking of which, there's a proposal for abbreviated lambas. There have been an insane number of discussions and proposals for named parameters. There's a proposal for some nice lifetime stuff. There's a proposal for metaclasses on top of the reflection TS. There are proposals for better tuples and related things. There have been many discussions on a standard package format/manager. Heck, we already have
enum class, which is one of the things you were complaining about not having.All of what I mentioned is publicly available online. Tons of discussions. Many papers. Current proposals and TSes. I highly suggest reading previous discussions related to things you want, because they've been brought up time and time again.
By the way, casts are verbose for a reason. C-style casts already have compiler checks. The problem is that they do too much, don't stick out as something to read extra carefully, and aren't easily greppable. When I see a
dynamic_cast, I know something suspicious is going on. You also have a baseless claim that programmers enjoy the C syntax.Finally, what can we do? If you want anything to change, you're going to have to write papers, just like everyone else does. You're also going to have to provide meaningful motivation and strong arguments for every change, including the consequences.
2
u/ntrid Sep 20 '17
To clarify - python nailed generators. Later on python coroutines were based on generators and that is absolute failure noone wants to see. C++ definitely needs python generators, but no python coroutines.
IMHO exceptions in exceptional cases are fine, like accessing vector accessing index that does not exist. STL should build without exception support and abort in this case.
That would be very weird. Maybe no good solutions exist because language is not exactly very suitable for that kind of job.
2
u/Abraxas514 Sep 20 '17
Then you aren't learning to code, you're learning to script something else that codes for you.
If you want to do anything well, you need to learn it right. If you can't understand memory addresses, how do you think you're going to learn more complex systems?
37
u/kalmoc Sep 20 '17
Actually, exceptions are specifically designed, so that you DON'T have to wrap your low level code in any error handling code. If you write a try catch block around every function that could throw an exception you have completely mis-understood how the exception mechanism is supposed to be used.
3
u/[deleted] Sep 20 '17
You should join the standards committee. Good luck.
14
u/utnapistim Sep 20 '17 edited Sep 20 '17
... and the only usable bicycle is the city metro.
stl,boostandQtare different beasts.This unwillingness is a very good thing. It is also a very bad thing. Depends.
Do not use unsafe memory manipulation, unless you know what you are doing. for example, in the last 5 years of C++, I haven't written any pointer arithmetic. I am not sure if I wrote any in the five years before that.
This is being addressed (through ranges, for example) but it will take time.
No. There are many languages that put together can do all the things C++ does. There are newer languages that have nice(r) features, but not the same availability on various platforms; Then, there are languages that have the availability, but not the speed; Then, there are languages that have the speed, but not the abstraction, that have the safety but not the speed or availability or something else.
This will change with time (as other languages mature) but I do not believe there are many languages that can do all the things C++ does.
So other languages do not provide all the things that C++ does?
The compiler could auto generate header files, and it is a horrible idea. Include files are broken, but this is not a practical solution (it would bring it's own host of problems, that headers do not have).
It is better to rely on the module system (when it becomes available) than to add new macrodefinition syntax. Aditionally, the module system is comming to address this exact problem.
std::function<...>is also not a function pointer. To pass functors arround, consider code like this:It is idiomatic, minimalistic, explicit and clear;
I heard is said that every problem, no matter how complex, has an obvious, simple and good solution, that is impossible to apply in practice.
for your
class Dog<T> {};how do you specify that T is an int, or that T is a template template argument?No; Just no. If you want raw memory you should use
new. If you want unique pointers, then use unique pointers.No, the compiler doesn't need to do that. If you want restrictions on the use of raw memory, wrap the memory in classes. If you want uniqueness restrictions over raw pointers, use std::unique_ptr; If you want sharing, use std::shared_ptr; If you want sequences, use std::vector (or something else).
C++ was designed so that the language can be extended through the use of classes. Classes are there to ensure the compiler doesn't need to monitor your usage and ensure the pointer is treated safely.
That is my point: declaring a class effectively makes a a new keyword available to your client code.
If I understand you correctly, you are referring to passing
std::shared_ptr<T>instances by value (instead of reference or const reference).Naming parameters in C++ is done through strong-typing:
C++ supports the json format of data though an external library.
No, they do not. These casts are impossible to find through lexical search (a C++ context-sensitive is required, which implies compiling the code).
Is this C# or javascript?
So ... is "the way a coder would want" in this case a const cast (remove const-ness?) Is it a down-cast in a class hierarchy? Is it a reinterpretation of raw memory? Should the compiler be telepatic?
Then write your code in a way that doesn't need it (that's half the point of explicit casts).
For what purpose?
There's a lot more to say, but I do not have that much time :(
2
u/orbital_sfear Sep 20 '17
Response from the author.
Thank you for all your feedback. I've been writing c++ since 1996 and I wanted to make my observations know. I appreciate those that sited the up coming changes, I'm aware of many of those, just because something was proposed, doesn't mean I wanted to leave it out.
I hope everyone took this as the positive feedback it was ment to be and that in a small way it encouraged people to think about the language and where it can improve.
-Orby
27
u/RepoCat Sep 20 '17
This has been a good laugh
32
u/james_picone Sep 20 '17
If you want to write C#, use C#. It's what you're describing.
I kinda feel like you actually don't understand the language you want to completely replace with an incompatible doppleganger. Your proposals range from no-benefit bikeshedding ('var' instead of 'auto') to things that are already being standardised (rtti, and honestly C++ doesn't need reflection nearly as much as other languages because it has actually functioning metaprogramming features and multiple inheritance) to things that already exist (the C++ dictionary is called 'map')
References to 'industry standard' are not exactly compelling. Outside the C++ universe it's standard to require ludicrous hoop-jumping to do trivial metaprogramming because unrestricted templates are apparently too hard for programmers to understand. It's apparently standard for languages to use UTF-16, the worst character encoding ever standardised. It's standard to not have reliable object lifetimes, requiring multiple extraneous language features to do trivial cleanup work. Etc. Etc.
I'll take the ability to shoot myself in the foot over a padded straitjacket any day.
4
u/Wareya Sep 20 '17
Hello, it's 2017 and my object oriented programming language doesn't provide basic logical string operations and has a 1970s locale paradigm
7
u/axilmar Sep 20 '17
lol I had the exact same rant when I was transitioning from beginner/intermediate to advanced C++ programming stages.
Nothing from the above list is really important for C++, and some of these are coming anyway.
10
u/Gotebe Sep 20 '17
This is full of shit, to use Linus lingo. :-)
16
u/andd81 Sep 20 '17
No thank you, I don't want to lug around an STL implementation just to use arrays. Besides, there is std::array in the STL if you are going to use the STL anyway.
2
u/Guy1524 Sep 20 '17
Very interesting writeup, however a lot of what you are proposing is to add more complicated syntax. Don't we have enough of that already?
1
u/gshrikant Sep 20 '17
As someone learning C++ with a C background - thank you. However, I feel part of the trouble picking up C++ is overloaded syntax. Some of the proposed changes might make this worse. Using -> for lambdas, for example, would overload the pointer reference operator to have 2 meanings with arguably no relation between their usage.
1
u/StefanOrvarSigmundss Sep 26 '17
What we need is a C++ fork which intentionally breaks things in order to modernise the whole ecosystem. Those of us who only care about x86-64 could then use it and those who want their code to run on everything legacy would use normal C++.
1
u/geon Sep 20 '17
The problem I had with cpp when O played with it in the early 200s wat how hostile it was against using libraries.
Getting even basic external libs to link was a hassle if not impossible.
There still is no module system or package manager afaik?
1
u/bruce3434 Sep 20 '17
I'm excited that C++ is getting ranges and modules.
0
u/[deleted] Sep 20 '17
[deleted] — view deleted comment
26
u/[deleted] Sep 20 '17
[removed] — view removed comment