Does carbon solve the fundamental issue in c++ which is referring / pointing to objects outside their lifetime #3245
Kubiyak
started this conversation in
Language design
Replies: 1 comment 5 replies
-
Safety, especially memory safety, is a top priority for Carbon. However, we are deferring that until the 0.2 milestone because we think we won't be able to design it effectively until we have more of the language foundations in place. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Does carbon provide any means of restricting references and pointers to objects?
The main issue with c++ is that references and pointers are allowed to all objects without discretion which invariably leads to references and pointers to objects after (or even sometimes before) their lifetimes.
Carbon only has relevance if it can provide some mechanism for an API designer to limit misuse of interactions with that API. Providing some means to bound and limit the taking of references and pointers to objects would be helpful. At least provide some means to prevent the passing of specfically designated types by reference. For example, it should not be possible to return specifically designated smart pointer types by reference. The RAII qualities of smart pointers are defeated by accessing the same via reference or pointer. I'm not suggesting that Carbon turn into Java but lets be cold and honest about why c++ fails.
If this feature exists, I will be a lot more interested in Carbon. Without this feature, Carbon is just a not so glorified IDE for c++. I'll stick w/ CLion if all Carbon can do for me is what an IDE can.
Beta Was this translation helpful? Give feedback.
All reactions