New Standard library for cpp2? #620
-
Wouldn't it make sense to create a new standard cpp2 library to show what cpp2 is capable of when compare to the cpp1 standard library? One of major criticisms that I have with regards to c++ is frequent use of std:: just to call the standard library function. That type of behavior in the cpp world has been normalized when it shouldn't, even in cases when you are just using the standard c++ library and nothing else!
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 7 replies
-
I have a question. Your criticisms don't align with your suggestion (for
me).
If cpp2 were to have a new standard library, it would still be under be
some namespace (std2 for example) and instead of using "std::", we would
use "std2::" or else. So this doesnt seem like the solution.
…On Tue, 29 Aug 2023, 23:48 12345swordy, ***@***.***> wrote:
Wouldn't it make sense to create a new standard cpp2 library to show what
cpp2 is capable of when compare to the cpp1 standard library?
One of major criticisms that I have with regards to c++ is frequent use of
std:: just to call the standard library function. That type of behavior in
the cpp world has been normalized when it shouldn't, even in cases when you
are just using the standard c++ library and nothing else!
- Alex
—
Reply to this email directly, view it on GitHub
<#620>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2KJHTQEEONUNYJYJI763DTXXYW5TANCNFSM6AAAAAA4DLFAEY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Creating a new standard library is out of scope for Cppfront, I believe. Writing Cpp2 code is an improvement over Cpp1¹, I think its more beneficial to write new extensions in Cpp2.
Like Cppfront itself. ¹: Except where Cpp2 or Cppfront can't meet your expectations yet. |
Beta Was this translation helpful? Give feedback.
-
A standard library is just as important as the language itself. The Standard Template Library was a major selling point for C++ back then.
The last thing that Cpp2 needs is feature creep. Even more so when Cpp2 is in currently in experimentation mode and hasn't been "Officially" release for public use.
This is what I mean normalized behavior when it shouldn't. Even more so that we have modules. |
Beta Was this translation helpful? Give feedback.
-
@JohelEGP wrote:
I'm very curious about this as I want to learn how it feels for others -- is there any chance you could make a short writeup about your experience with this, with a few code examples and your observations on things you noticed pro/con, as a blog post or even just a private email? |
Beta Was this translation helpful? Give feedback.
-
The entire C++ standard library is available. A few parts still require contortions to use (e.g., I haven't written declaring function types yet for Using the C++ standard library, and other libraries, is intended to be "fully supported from Cpp2, but better when used from Cpp2." In particular, by default bounds checking is enabled, so using subscripting on any sequence container from Cpp2 code automatically does bounds checking (without any change to the library code, the check is injected at the Cpp2 call site). For a few particularly dangerous C++ standard library features that we already teach people to avoid, I'm considering making them deliberately harder (e.g., require prefixing their names with I do plan to continue adding things in |
Beta Was this translation helpful? Give feedback.
-
Oh that is interesting, I need to go look up what is considered unsafe and avoidable in the std library!
On 3 December 2023 19:23:42 Herb Sutter ***@***.***> wrote:
The entire C++ standard library is available. A few parts still require contortions to use (e.g., I haven't written declaring function types yet for std::function so you write an extra line as a workaround) but they are all intended to be available.
Using the C++ standard library, and other libraries, is intended to be "fully supported from Cpp2, but better when used from Cpp2." In particular, by default bounds checking is enabled, so using subscripting on any sequence container from Cpp2 code automatically does bounds checking (without any change to the library code, the check is injected at the Cpp2 call site).
For a few particularly dangerous C++ standard library features that we already teach people to avoid, I'm considering making them deliberately harder (e.g., require prefixing their names with unsafe_) or impossible to use from Cpp2. But I mostly haven't done that yet.
I do plan to continue adding things in cpp2util.h that the standard library doesn't yet have, when they improve safety or usability.
—
Reply to this email directly, view it on GitHub<#620 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AALUZQK72KBHTEF7FTDLOQDYHTGTXAVCNFSM6AAAAAA4DLFAE2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TONBVGY4TA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
The entire C++ standard library is available. A few parts still require contortions to use (e.g., I haven't written declaring function types yet for
std::function
so you write an extra line as a workaround) but they are all intended to be available.Using the C++ standard library, and other libraries, is intended to be "fully supported from Cpp2, but better when used from Cpp2." In particular, by default bounds checking is enabled, so using subscripting on any sequence container from Cpp2 code automatically does bounds checking (without any change to the library code, the check is injected at the Cpp2 call site).
For a few particularly dangerous C++ standard library features that we alrea…