Consider the following use case:
I have a std::map<std::string, std::string> that sometimes contains strings consumed from C APIs.
They are owned by the C API that I consumed them from.
Other times, I have strings that are consumed from C++ APIs and I can either move them or reference them in some way.
The strings consumed by the C API are copied into std::string because a std::string owns the data. This is wasteful.
We can use std::variant<std::string, std::string_view> to hold both string types but that makes the code far more complex than it should and occasionally still requires copying when other APIs require you to provide an std::string.
string_view and string has almost the same interface (sans c_str() and data() which IMO should be unified). It makes some sense to allow them to be interchangeable.
If we had a base class for all common string-like data types we could make that requirement less specific by changing the string type in Thrift to be the base class of all strings and less memory copying would be involved when it is not necessary.
I'm sure that are ton of additional use cases where this applies.
Consider the following use case:
I have a std::map<std::string, std::string> that sometimes contains strings consumed from C APIs.
They are owned by the C API that I consumed them from.
Other times, I have strings that are consumed from C++ APIs and I can either move them or reference them in some way.
The strings consumed by the C API are copied into std::string because a std::string owns the data. This is wasteful.
We can use std::variant<std::string, std::string_view> to hold both string types
occasionally still requires copying when other APIs require you to provide an std::string.
string_view and string has almost the same interface (sans c_str() and data() which IMO should be unified). It makes some sense to allow them to be interchangeable.
If we had a base class for all common string-like data types we could make that requirement less specific by changing the string type in Thrift to be the base class of all strings and less memory copying would be involved when it is not necessary.
I'm sure that are ton of additional use cases where this applies.
Are there any technical reasons why string_view and string don't share the same base class?
Why the difference in APIs between c_str() and data() exists?
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+unsubscribe@isocpp.org.
To post to this group, send email to std-dis...@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
On Saturday, 2 September 2017 08:39:05 PDT Patrice Roy wrote:
> @Ville : would that be a problem in this case, since the source is known to
> be a null-terminated C string?
But you can't know that from the point where std::string_view is used. That's
why it doesn't have a .c_str() member: you can't use it as a C string.
IMHO the only 'safe' interface for the constructor of a string_view is one of:(const char* first, const char* last), or(const char* first, size_t length), or(Iter first, Iter last)Now you can't create one by accident and cause a segfault without meaning to.But of course, then a string_view would simply be a specialisation of any pair of pointers delimiting a range of contiguous objects - which is what boost range is, is it not?As to the question, yes I think a better design would be for :string_view to be derived from basic_immutable_char_range<SomeImpl>and string to be derived from basic_mutable_char_range<SomeImpl> which itself would be derived from basic_immutable_char_range<SomeImpl>
On Monday, September 4, 2017 at 9:34:38 AM UTC-4, Richard Hodges wrote:IMHO the only 'safe' interface for the constructor of a string_view is one of:(const char* first, const char* last), or
(const char* first, size_t length), or
(Iter first, Iter last)
--
void some_func(string_view s);
some_func("a string"s);std::string some_func2();
string_view sv = some_func2();
void some_func(string_view s);
some_func("a string"s);
--
>This is a great example, and I think the beginning of a good guideline.
> Don’t allow references to be returned from rvalues. Enforce like this:In actual fact, in this motivating example, in order to maintain utility the library maintainer would have to provide 2 overloads on this newly refactored CurrencyPair class wouldn't he? The motivating example returned a temporary CurrencyPair.In which case the refactorer now has to supply 2 almost-identical overloads:struct CurrencyPair{auto base() const& -> std::string_view; // sort of safe, provided the caller does not assign to an auto unwittinglyauto base() && -> std::string; // perfectly safe.};This idiom is going to be common.
This idiom is going to be common.
--
On Monday, September 4, 2017 at 2:44:28 PM UTC-4, Richard Hodges wrote:> Any such range types would ultimately store pointers to the data, right? So, how would `std::string` be able to do SSO over the data in the base class?> It can't. It would have the SSO buffer in addition to the pointers in the base class.I disagree with your analysis.The StorageImpl object of std::string would necessarily be of a different type to the StorageImpl of the string_view (the data is mutable and extendible for a start). As long as it has a correct interface there's no problem, and no reason it can't implement SSO at all.
But if `string` is a derived class of `string_view`, then `string` will contain `string::StorageImpl` and `string_view::StorageImpl`.Inheritance is the wrong tool here. While they both model similar interfaces, they implement them differently.
> But if `string` is a derived class of `string_view`, then `string` will contain `string::StorageImpl` and `string_view::StorageIm
I have not been clear.consider:template<class SomeStoragePolicy> struct immutable_string_concept;template<class SomeStoragePolicy> struct mutable_string_concept : immutable_string_concept<SomeStoragePolicy>;
This is a great example, and I think the beginning of a good guideline.
Don’t allow references to be returned from rvalues.
> Perfectly safe.eat(MakeCurrencyPair().base(policy::as_view));even safer.In the same way that std::move(x) is safer than the (for good reasons, disallowed) implicit cast from x& to x&&.Execution policies are part of c++17. Why not return value policies? In this way the 'return by reference' behaviour is explicitly stated in the code.
Problem is that boost (understandably) puts a premium on working with older compilers, and this C++ language feature was late to get implemented. These circumstances could easily be responsible for the suppression. … Or maybe you’re right and it’s a terrible idea. But so far you haven’t shown _why_ it is a recipe for disaster, so I’m unconvinced.
struct A1
{
std::string str() const { return s; }
void mod() { s = "Launch the missiles " + s; }
std::string s = "Photon Warrior";
};
struct A2
{
std::string str() const && { return s; }
std::string const& str() const & { return s; }
void mod() { s = "Launch the missiles " + s; }
std::string s = "Photon Warrior";
};
struct A3
{
std::string str() const && { return s; }
std::string_view str() const & { return s; }
void mod() { s = "Launch the missiles " + s; }
std::string s = "Photon Warrior";
};
template<typename T>
void TestIt()
{
std::cout << __PRETTY_FUNCTION__ << '\n';
auto s1 = T{}.str();
std::cout << "s1: " << s1 << '\n';
T t;
auto s2 = t.str();
std::cout << "s2: " << s2 << '\n';
t.mod();
auto s3 = t.str();
std::cout << "s3: " << s3 << '\n';
std::cout << "s2: " << s2 << '\n';
std::cout << '\n';
}
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussio...@isocpp.org.
> Everyone, presumably including you, has known about string_view formany years now; why did you leave it so late to raise any objections?There is no well-known public forum for this kind of discussion. The vast majority of c++ users are not part of the committees' process. I think it would be healthy if there was a more public forum, and indeed a contribute-able git repo and issue tracker. It would be more healthy.
I have no objection to a "range of chars" object per-se. I saw that one was coming, thought "that's nice" and dismissed it because until the new standard comes out and is supported directly by all compiler vendors, our projects will remain on c++14.
It never occurred to me that the implicit conversion would be slipped in on the std::string interface. It's such a counterproductive idea.
Who would modify a perfectly well known interface and create a dependency between two unrelated classes? And yes, they are unrelated. They do very different things. Std::string is 80%resource management, string_view merely supports a limited set of string queries.So here is your first user feedback.
From someone who mandates the use of standard-compliant c++ in his organisation, because he trusts the committee when they say, "it should be hard for people to do bad things".
That trust has been tarnished with string_view. The impression here is committee is no longer favouring correct programs of explicit intent. it is favouring a single moment of convenience over correctness.C++11 allowed me to make the case that c++ was still the correct, viable and dependable language for our software stack. String_view damages that argument. Because now I will have to hire only experts, beginners will once again become a liability.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+unsubscribe@isocpp.org.
> But that doesn't make it wrong.The level of defensiveness I see tells me that deep down, you know it's wrong.> Seriously? One implicit conversion, and you immediately start not hiring peopleThere used to be a fairly well-known adage that it takes anyone at least two years to get to the level of competence with c++ that they can be let loose in a production environment.This was largely because of the ubiquitous use of pointers and a lack of formal methods for managing object lifetimes in a standard way.It seems to me that we're heading back that way.> And we still don't have a way to deal with constructor failures without heavy-weight exception handling.This is a whole other area of pointless navel-gazing. We have std::variant<Val, Error> (and have had boost's versions for aeons) for the result of a maybe construction via a factory function. Both Val and Error can easily be made exception-free.In any case, exceptions are only (marginally) expensive when they fire. The cost of checking whether an exception occurred in compiled code is less than the cost of switching on a variant's discriminator.Any performance loss people may imagine they suffer from exceptions being the only way to signal the non-creation of an object (they don't) is that in c++, objects are either created fully or they don't exist. That's *fantastic*. It means you never have to put null_ptr checks in logic. Every null_ptr check we don't have to do is a conditional branch we don't have to execute, an error case we don't have to write. Who wouldn't want that?Finally,C++ needs fewer pointless arguments over whether c++ objects really occupy bytes in memory or not. I refer of course to the infamous nonsense of "std vector not being really legally implementable in c++."C++ needs better real-world standardised support. Networking, graphics, console, input devices, crypto, framing protocols, HTTP (version 1.1 having been invented a mere 20 years ago). So people can actually use it to do something useful out of the box. Boost is starting to go this way, thank goodness. But try to get a fully correct c++14 build of boost working, with ICU support in regex and SSL support in asio, on an ipad within a day. OMG! The number one complaint I get from my team is that they spend more time on building dependencies and tuning the build system than they do writing code - we write cross-platform, windows, linux, osx, ios, android. My Java guys can't believe the nonsense we have to go through just to get a program to compile.C++ needs standardised packaging support. Like javascript's package.js. At the moment, the best cross-platform dependency manager I have found is the combination of CMake and hunter (github.com/ruslo/hunter). It's good, but nowhere near as comprehensive as npm, gulp, et. al.C++ needs more focus on making it useable, and less on inflicting intermediate users with a list of 100 things that 'thou shalt not do because it's dangerous'. For years we have been encouraging people to "express intent succinctly in code, let the compiler work out the optimisation". This was good advice. Compilers are getting really good. To make your program go faster, assuming you chose the correct algorithm, simply download a newer version of the compiler. For the general case, there is no need for a micro-optimisation like string_view. Any string you ever create, you'll eventually hand off to an OS to do some IO. The performance argument ends right there.After the release of c++11 I watched Herb Sutter's talk on how in future the c++ standard could include a 3d graphics interface. I was stunned, enthused. "There's life in the old c++ dog yet", I thought. But no. We've had 6 years of dithering over whether to include networking-ts or not.My son wants to learn c++ to write a game (of course that's how almost everyone starts, right?). So I sat him down and explained about how we need to choose a graphics engine library, a sound library, maybe create some abstractions around os-specific stuff. You could see him losing interest. "What you mean is", he said, "is that the language isn't complete."Whether you take issue with my tone is unimportant. What I think is important is that the momentum that came from the c++11 release has been lost, and we're back to stagnant circular discussions about minutiae.If you think c++ is a good thing as I do, you ought to feel that that's important too.
>>There is no well-known public forum for this kind of discussion. The vast majority of c++ users are not part of the committees' process. I think it would be healthy if there was a more public forum, and indeed a contribute-able git repo and issue tracker. It would be >>more healthy.>OK, let's say that such a forum existed. And that you found it in 2015. And that you actually paid attention to the various proposals, read the details, saw the implicit conversion and challenged it. You made your case on this forum and... your case was rejected by the >committee. That is, they considered your concerns, but decided to allow implicit conversions anyway.Isn't this that forum?
A language is never complete in the sense you mean. There are plenty of library collections that are nearly complete in themselves for certain kinds of application. QT, WxWidgets, Poco, wtty. opencv ...search engines turn the internet into a pretty good package repository though the amazing range of choices for build systems etc. are problematic as you point out.Very few languages have got that right perhaps because people's needs vary so far.Java has gone through numerous build systems, ant, maven, gradlePython has had setup.py, pip and easy_install and eggs replaced by wheels etc.It seems like everyone who builds a new language or package manager falls short of including and surpassing all previous learning in that area. Sometimes out of ignorance but more often simply because its a difficult problem and a good enough solution now beats a better solution in the future. That said I'm confident of progress.Also>>There is no well-known public forum for this kind of discussion. The vast majority of c++ users are not part of the committees' process. I think it would be healthy if there was a more public forum, and indeed a contribute-able git repo and issue tracker. It would be >>more healthy.>OK, let's say that such a forum existed. And that you found it in 2015. And that you actually paid attention to the various proposals, read the details, saw the implicit conversion and challenged it. You made your case on this forum and... your case was rejected by the >committee. That is, they considered your concerns, but decided to allow implicit conversions anyway.Isn't this that forum?
You know, those little things that are available out of the box in every other popular computer language.
> I don't think you have a clue what it means to certify something, or the costs involved. "It compiles" is not sufficient, q.v. "undefined behaviour".I think I must have hurt your feelings. You're on the brink of both staw-man and ad-hominem with this one.I apologise. I am not here to discredit you personally. I am here so that information can flow back from an enthusiastic (and pretty good) c++ user to the people who are making the decisions about the language I have chosen over all others to care about.>> and so on. Basically a standard stackoverflow. (which is the de-facto
>> standard in consulting experts is it not?)
> No, it's not.I respectfully submit that you're a little behind the times (which is odd, because of the two of us I am certain that I am the older). There's an entire generation of developers, in all languages, who use stack-overflow as their primary source of programming-related information. For good reason - the information is collectively sourced and instantly peer-reviewed by a massive enthusiastic community of contributors. The vast majority of c++ developers will never read the standard. They will consult SO, and get complete, annotated information delivered by knowledgable experts on the subject - with examples.
The c++ standards committee could learn a lot from this model.
> DirectX is not a good example, since it's not a standard and there's exactly one implementation by one vendor.There are exactly 12 iterations of the library suite from the original vendor. They are all compatible. As you are well aware, I was illustrating how interfaces can successfully evolve over time.You mention bugs. These are a symptom of there being only one implementor. Had there been a c++ standard for 3d, there would have been multiple implementors competing. There would be fewer bugs. There are examples in the wild. Ogre3D, Irrlicht, etc. All of varying quality and approaches but all with the same sensible design goal - standardise the damned interface, get rid of problematic proprietary interfaces. These libraries were born out of need. If they're needed in the real world, then the concept is needed in the standard.> The C++ committee works around the ISO limitations and requirements just fine.> I'll repeat what I said: the C++ standard is developed in one of the most open ways I've seen when it comes to standards, on par with IETF.Maybe, but still not good enough. I've been in technology long enough to know that committees are not the best way to achieve progress. Boost exists only because the standard isn't good enough.
> Aye.Fantastic. We have a point of agreement. Let's work on that. Now that we agree that it's ok to bring something slightly imperfect out and refine it later, let's not delay networking, ranges, modules, executors and future continuations any longer, eh? 6 years is quite a long time to wait.
On Wednesday, September 13, 2017 at 12:20:20 PM UTC-4, Richard Hodges wrote:>> and so on. Basically a standard stackoverflow. (which is the de-facto
>> standard in consulting experts is it not?)
> No, it's not.I respectfully submit that you're a little behind the times (which is odd, because of the two of us I am certain that I am the older). There's an entire generation of developers, in all languages, who use stack-overflow as their primary source of programming-related information. For good reason - the information is collectively sourced and instantly peer-reviewed by a massive enthusiastic community of contributors. The vast majority of c++ developers will never read the standard. They will consult SO, and get complete, annotated information delivered by knowledgable experts on the subject - with examples.
The c++ standards committee could learn a lot from this model.SO is for asking questions and getting answers. It's specifically designed to avoid discussions, not promote them. And discussion is what you're wanting. So SO is a poor model.
On Wednesday, 13 September 2017 17:58:40 UTC+1, Nicol Bolas wrote:
On Wednesday, September 13, 2017 at 12:20:20 PM UTC-4, Richard Hodges wrote:>> and so on. Basically a standard stackoverflow. (which is the de-facto
>> standard in consulting experts is it not?)
> No, it's not.I respectfully submit that you're a little behind the times (which is odd, because of the two of us I am certain that I am the older). There's an entire generation of developers, in all languages, who use stack-overflow as their primary source of programming-related information. For good reason - the information is collectively sourced and instantly peer-reviewed by a massive enthusiastic community of contributors. The vast majority of c++ developers will never read the standard. They will consult SO, and get complete, annotated information delivered by knowledgable experts on the subject - with examples.
The c++ standards committee could learn a lot from this model.SO is for asking questions and getting answers. It's specifically designed to avoid discussions, not promote them. And discussion is what you're wanting. So SO is a poor model.Rather I think changes should follow sound software engineering practices. That means issue tracking and source control are essential.The C++ committee already has a document naming policy which seems pretty sound.This collection of forums is reasonable for discussion.
> SO is for asking questions and getting answers. It's specifically designed to avoid discussions, not promote them. And discussion is what you're wanting. So SO is a poor model.SO allows many respondents to post answers to questions, along with practical, executable code. The user base then votes on the efficacy of those answers. In the vast majority of cases the best answer rises to the surface. This happens within hours or days.It's a fantastic model. The fact that there is no room for opinion is great - all claims are tested mercilessly. It's pure information.It's a perfect model for defining the behaviour of new standard libraries.
> But Boost advances through committee...Not really, it advances through a base of volunteers who simply step up and fix or review code.
There is a steering committee, and their latest decision demonstrates nicely what happens when a few people make a decision without communicating effectively with the entire user base.When the announcement went out that the boost steering committee had decided to move from bjam to cmake, a number of long-term boost contributors and maintainers were outraged. One to the point where he simply quit.Much of the user base had not encountered cmake and were bewildered.For the record, I support the move, but the method was not democratic or crowdsourced, so it'll be painful.
> There is a big difference between making a mistake and negligence. You should always attempt to avoid mistakes.Now you're just looking for things to argue about.Since I have become so animated by what I consider to be a serious defect in std::string_view (well, actually an update to std::string as it happens), do you honestly think I am promoting negligence?Come, come.
Glad to see you mention Scheme, a notable example with unspecified evaluation order in function applications explicitly by the design of the language :)
> Many of the libraries you're talking about are big; much larger than most SO questions or answers.... etcThis is reducto ad absurdum.The general model of SO is that:1. it is easily accessible by everyone, without leaving their cubicle.2. it encourages collaboration.3. feedback on ideas and solutions is fast, and ruthless and based on the wide experience of participants.4. in the main, only good, evidence-based answers (read: proposals and revisions) get high numbers of votes. The votes (say, beyond 10) are a strong indication of a strong answer (read say, 100 and strong proposal).5. did I mention that participation is easy and quick? No need for trips to conferences half way around the world. Just an exchange of ideas and good, collaborative, evolving decision-making.
--
> Many of the libraries you're talking about are big; much larger than most SO questions or answers.... etcThis is reducto ad absurdum.The general model of SO is that:1. it is easily accessible by everyone, without leaving their cubicle.
2. it encourages collaboration.
3. feedback on ideas and solutions is fast, and ruthless and based on the wide experience of participants.
4. in the main, only good, evidence-based answers (read: proposals and revisions) get high numbers of votes. The votes (say, beyond 10) are a strong indication of a strong answer (read say, 100 and strong proposal).
5. did I mention that participation is easy and quick? No need for trips to conferences half way around the world. Just an exchange of ideas and good, collaborative, evolving decision-making.
If this implicit-conversion-of-string-to-string_view had been posted on a public forum, with people given the opportunity to vote on the reasons for and against, I expect we'd have had an even split of people who think the convenience is worth the danger, and people who think the danger is an unnecessary carbuncle. That would have been an excellent indication that it needs to be rethought, and a better solution provided.
> But feedback on broad questions or opinion-based questions is: vote-to-close. Standards proposal discussions fall into the second category.There is no reason people could not vote on opinions and demonstrations of new standard functionality,
Everyone in this thread seems to take everything absolutely literally. Too much time with code perhaps. :)What I am saying is that SO is *visible*, *immediate* and *collectively sourced*. The c++ standard evolution is not.
If I were to say "it's bad to allow implicit conversion to a reference type masquerading as a value type because xxx", thousands of people could voice their agreement or not with that statement with an immediate vote, and maybe even comment or reason, which itself could be voted on. The issue could be solved decisively.
I am *not* saying "SO is an absolutely perfect fit, let's just fork the code and use that in place of a standard".I am saying that the model of collective participation *is* a perfect model for evolving a common set of idioms, and libraries.
OK guys, you win.It's a nice cosy little club and everyone else is wrong. I get it.
c++ will tootle along getting nowhere.6 years is a perfectly acceptable time to wait to not get a networking library.
Happy?
Complaining on this forum and doing nothing else accomplishes nothing.
I might point out
that there's been an implementation of experimental::string_view in
libstdc++ since 2013,
Claiming that you
haven't been able to try string_view out is a lie.
> Many of the libraries you're talking about are big; much larger than most SO questions or answers.... etcThis is reducto ad absurdum.The general model of SO is that:1. it is easily accessible by everyone, without leaving their cubicle.2. it encourages collaboration.3. feedback on ideas and solutions is fast, and ruthless and based on the wide experience of participants.4. in the main, only good, evidence-based answers (read: proposals and revisions) get high numbers of votes. The votes (say, beyond 10) are a strong indication of a strong answer (read say, 100 and strong proposal).5. did I mention that participation is easy and quick? No need for trips to conferences half way around the world. Just an exchange of ideas and good, collaborative, evolving decision-making.
On Wednesday, September 13, 2017 at 5:57:27 PM UTC-4, Richard Hodges wrote:> SO is for asking questions and getting answers. It's specifically designed to avoid discussions, not promote them. And discussion is what you're wanting. So SO is a poor model.SO allows many respondents to post answers to questions, along with practical, executable code. The user base then votes on the efficacy of those answers. In the vast majority of cases the best answer rises to the surface. This happens within hours or days.It's a fantastic model. The fact that there is no room for opinion is great - all claims are tested mercilessly. It's pure information.It's a perfect model for defining the behaviour of new standard libraries.... how?Many of the libraries you're talking about are big; much larger than most SO questions or answers. Interactions between components will be complex. Just consider the networking TS, based on ASIO. How would you debate the asynchronous execution model, without affecting basically all of the other APIs in that library?Furthermore, the idea that polling random people to decide what goes into the standard library is fundamentally terrible. We should decide what goes in there based on good design, not on the whims of random people who will upvote because someone made a joke in their post.
Even though I totally disagree with Richard's tone in this discussion I do understand his frustration with the current status quo of C++. I felt like this myself in several occasions.Despite my admiration for the members of the committee and all the effort they put in the standard, I think there's plenty of room for improvement in a few areas.The most critical in my opinion is that the communication channel between community and committee is too narrow and therefore the feedback is insufficient.There's no clear path for trying a new library or language features.As example, it doesn't matter if string_view has been available for several years if no one knows about it, which purpose is it supposed to serve and how to use it.It's very hard for someone that doesn't follow the standard to get to know about a proposal and where to try it.
The committee is counting on volunteers but there's no effort to make this need explicit. Honestly, a language complex as C++ needs all the help one can get.
On the contrary, the few channels available (this one and std proposals) are very closed (and sometimes it feels unwelcoming) to the general community.
The community gets their hands on language and library changes very late in the process.And boost can't serve much as a test bed because the experience has been proving that once something from boost passes through the committee, a whole lot changes.Most of the record of such changes and decisions is closed to the general community - because ISO doesn't allow that to be public in some cases.The majority of the community is not interested in submitting proposals. The bar is too high and it's too big of a commitment.But everyone is eager to try the "next big thing". The current process is missing all this participation.
Change is slow and corrections even slower.The 3-year cycle is an eternity in the current environment of software development.If what has been discussed here about string_view is really a problem it may take up to absurd 9 years to fix the standard.3 years to confirm it was a bad idea, then 3 deprecate in the next standard, then 3 to remove on the next.By that time Rust might have took over all native development! :-/
Worst of how much harm this can cause to the users of the language and to the several applications plagued by it, it's how bad this is for the reputation of C++.Richard is right that all the good will and excitement brought by C++11 is being buried by what most of the community see as a bunch of bad moves on the direction of C++.Even though I don't share this point of view, I can't change how others perceive past events.I believe there's still time to get things right before C++ becomes the new COBOL.Here's a few (radical?) ideas:1) Break the standard in two - language and library - but not literaly.Keep the 3-year cycle for language, have a much shorter (4-month / per-meeting?) cycle for library changes.
Organize a different work group for the short cycle to not drawn resources away from the main work groups.What could be done under these short cycles:- Fixing defect reports- Improve on usabiliy and ease-of-use issues (example: make_unique)- Test library-only solutions that may demand languange additions not certain to be worth- Deprecating library features- Remove deprecated library features
- Merging library TSs which do not require language changesThen offload some of this work to the community.
One idea is having a centralized issue tracking where compiler and library maintainers and users could post defects or ask for improvements.2) Stop using std::experimental and instead use std::alpha / std::beta (or anything that indicates how close such feature is to the final standard).Companies/teams would be more comfortable adopting and testing pre-standard features.Provide an easy to access matrix of these features but different of the current one currently on isocpp.org that only contains the proposal number and vendor/version availability it would also have:- Synopsis of motivation- A collection of practical examples- A history of the decisions around the design- Such matrix could be maintained by the community similarly as the Core Guidelines.
3) Library proposals should have standard implementations which compile in all major compilers compliant with the targeted standard.- I am aware this is close to a de facto requirement.- But the change is that they would be centralized in a common repository.- Library features could target an older standard if that makes sense.- People not able or not willing to switch to a new standard could use the standard implementation.- A standard implementation would stop to be maintained once part of the standard.- If modified for adhering to a subsequent standard, it's assumed to be a new proposal.4) All the ideas above use, if you will, the "github" model for driving the work around the standard.But there's still room for a "StackOverflow" model to gauge interest and/or indicate deficiencies in the final product.As soon as the model above is available the parts of the library/language with more questions are either:- The "hot" features that everyone is looking into integrating in their work.- Or, the ones lacking documentation or too difficult to be used by the average user of the language.- StackOverflow itself can be used, no need to reinvent the will.Those ideas aim to drive more people to participate in the new "maintenance" work group as well in providing feedback.
They centralize the efford to make the standard happen - a single source of truth of sorts - that should be in the front page of isocpp.org.I believe this also addresses the concerns of both the camp of "C++ evolution is sluguish" and the camp of "I can't keep up with C++".
Also, the experts are left alone to drive the evolution of the language every 3 years but they will be watched more closely by whole community involved in maintaining the current standard.All this is suplemental to the current communities revolving around C++ such as clang, gcc, boost, etc. They would feed from the "standard" community and vice-versa.That said, who's interested in convincing the committee and tackle this challenge? :)
On Thursday, September 14, 2017 at 11:43:51 PM UTC-4, Ricardo Andrade wrote:Even though I totally disagree with Richard's tone in this discussion I do understand his frustration with the current status quo of C++. I felt like this myself in several occasions.Despite my admiration for the members of the committee and all the effort they put in the standard, I think there's plenty of room for improvement in a few areas.The most critical in my opinion is that the communication channel between community and committee is too narrow and therefore the feedback is insufficient.There's no clear path for trying a new library or language features.As example, it doesn't matter if string_view has been available for several years if no one knows about it, which purpose is it supposed to serve and how to use it.It's very hard for someone that doesn't follow the standard to get to know about a proposal and where to try it."Where to try it" is not something the standards committee can deal with. The committee publishes standards, not implementations.
As for knowing about a proposal... I really don't know how much more the committee can do. There's an entire website whose sole purpose is to be where standard C++ news items happen. That website publishes the mailings, which contain all of the proposals in question.What more do you want?People who want to affect the language should be expected to put forth the minimal effort of paying attention to channels of information. I don't think that's asking too much.
The committee is counting on volunteers but there's no effort to make this need explicit. Honestly, a language complex as C++ needs all the help one can get.And a language as complex as C++ needs as little of the wrong kind of help as it can get. That's really important too.
On the contrary, the few channels available (this one and std proposals) are very closed (and sometimes it feels unwelcoming) to the general community.I'm not sure how much more open you can get by having a forum/mailing list that literally anybody can sign up to use. The forums may be well-hidden, but once you find them, they're right here.The community gets their hands on language and library changes very late in the process.And boost can't serve much as a test bed because the experience has been proving that once something from boost passes through the committee, a whole lot changes.Most of the record of such changes and decisions is closed to the general community - because ISO doesn't allow that to be public in some cases.The majority of the community is not interested in submitting proposals. The bar is too high and it's too big of a commitment.But everyone is eager to try the "next big thing". The current process is missing all this participation.I'm not sure how useful such participation would be. If you're not able to put together a proposal... what exactly can you do to improve the standard? Ideas are easy; it's the details that are hard. And it's the details that we need.
Here's a few (radical?) ideas:1) Break the standard in two - language and library - but not literaly.Keep the 3-year cycle for language, have a much shorter (4-month / per-meeting?) cycle for library changes.How would that be anything other than a "literal" breaking of the standard into two? You can't release a new version of part of a document.
One idea is having a centralized issue tracking where compiler and library maintainers and users could post defects or ask for improvements.2) Stop using std::experimental and instead use std::alpha / std::beta (or anything that indicates how close such feature is to the final standard).Companies/teams would be more comfortable adopting and testing pre-standard features.Provide an easy to access matrix of these features but different of the current one currently on isocpp.org that only contains the proposal number and vendor/version availability it would also have:- Synopsis of motivation- A collection of practical examples- A history of the decisions around the design- Such matrix could be maintained by the community similarly as the Core Guidelines.There's no way that's going to fit into a "matrix".Consider `std::variant`. That proposal went through a huge number of changes. And the proposals kept extensive notes documenting not only each change, but the committee votes responsible for it. The history section for some of those revisions required pages. You can't fit all of that into a "matrix".
> Fork Clang and libc++, and go start your own language split from the needs of an ISO process. You can build whatever process you want for it.Should I read this as, "go make your own language, we don't want to hear your concerns about the one you've been using for a quarter of a century. It's ours."?It reads a little partisan I'm afraid.It strengthens my concern that this forum is an echo chamber for believers, and that dissenters are unwelcome.
On Thursday, September 14, 2017 at 11:43:51 PM UTC-4, Ricardo Andrade wrote:Even though I totally disagree with Richard's tone in this discussion I do understand his frustration with the current status quo of C++. I felt like this myself in several occasions.Despite my admiration for the members of the committee and all the effort they put in the standard, I think there's plenty of room for improvement in a few areas.The most critical in my opinion is that the communication channel between community and committee is too narrow and therefore the feedback is insufficient.There's no clear path for trying a new library or language features.As example, it doesn't matter if string_view has been available for several years if no one knows about it, which purpose is it supposed to serve and how to use it.It's very hard for someone that doesn't follow the standard to get to know about a proposal and where to try it."Where to try it" is not something the standards committee can deal with. The committee publishes standards, not implementations.
As for knowing about a proposal... I really don't know how much more the committee can do. There's an entire website whose sole purpose is to be where standard C++ news items happen. That website publishes the mailings, which contain all of the proposals in question.What more do you want?
People who want to affect the language should be expected to put forth the minimal effort of paying attention to channels of information. I don't think that's asking too much.
The committee is counting on volunteers but there's no effort to make this need explicit. Honestly, a language complex as C++ needs all the help one can get.And a language as complex as C++ needs as little of the wrong kind of help as it can get. That's really important too.
On the contrary, the few channels available (this one and std proposals) are very closed (and sometimes it feels unwelcoming) to the general community.I'm not sure how much more open you can get by having a forum/mailing list that literally anybody can sign up to use. The forums may be well-hidden, but once you find them, they're right here.
The community gets their hands on language and library changes very late in the process.And boost can't serve much as a test bed because the experience has been proving that once something from boost passes through the committee, a whole lot changes.Most of the record of such changes and decisions is closed to the general community - because ISO doesn't allow that to be public in some cases.The majority of the community is not interested in submitting proposals. The bar is too high and it's too big of a commitment.But everyone is eager to try the "next big thing". The current process is missing all this participation.I'm not sure how useful such participation would be. If you're not able to put together a proposal... what exactly can you do to improve the standard? Ideas are easy; it's the details that are hard. And it's the details that we need.
Again, if you want some kind of collective proposal development system, that's fine. But it still needs to lead to an actual proposal, not a bunch of ideas or functions that someone else has to cobble together into a working whole.
So what would this participation be, providing commentary on proposals? That just requires people who have actual domain knowledge to spend their time sifting through the 90% of worthless comments for the occasional nugget of genuinely useful information. That is a huge waste of time.
Change is slow and corrections even slower.The 3-year cycle is an eternity in the current environment of software development.If what has been discussed here about string_view is really a problem it may take up to absurd 9 years to fix the standard.3 years to confirm it was a bad idea, then 3 deprecate in the next standard, then 3 to remove on the next.By that time Rust might have took over all native development! :-/Worst of how much harm this can cause to the users of the language and to the several applications plagued by it, it's how bad this is for the reputation of C++.Richard is right that all the good will and excitement brought by C++11 is being buried by what most of the community see as a bunch of bad moves on the direction of C++.Even though I don't share this point of view, I can't change how others perceive past events.I believe there's still time to get things right before C++ becomes the new COBOL.Here's a few (radical?) ideas:1) Break the standard in two - language and library - but not literaly.Keep the 3-year cycle for language, have a much shorter (4-month / per-meeting?) cycle for library changes.How would that be anything other than a "literal" breaking of the standard into two? You can't release a new version of part of a document.
Organize a different work group for the short cycle to not drawn resources away from the main work groups.What could be done under these short cycles:- Fixing defect reports- Improve on usabiliy and ease-of-use issues (example: make_unique)- Test library-only solutions that may demand languange additions not certain to be worth- Deprecating library features- Remove deprecated library featuresOK, let's wind the clocks back to 2011. C++11 is about to be published, and you're going to deprecate `auto_ptr`. And this time, you're deprecating it with the expressed idea of replacing it with `unique_ptr`. So you're serious about it.
Now, forget everything about how long it takes to publish another standard. If you had to pick a year, what year would you say "OK, everyone's had enough time to switch to `unique_ptr`, so we're eliminating `auto_ptr`"?
I submit that no year before 2016 is workable. You need to be fully aware of just how much C++ code exists out there. And just how much of it needs to compile and yet isn't being actively maintained.
And we're talking about a drop in replacement here, where any differences between `auto_ptr` and `unique_ptr` will be obvious, noisy, and quickly resolved. And some people still complain after six years of warning.
To remove a more widely used feature would require at least as much time if not more. So I fail to see how the 3 year period is a problem. You cannot practically remove features that people are using like that. Not if you want a language that works.- Merging library TSs which do not require language changesThen offload some of this work to the community.You cannot publish an international standard based on random people on the Internet.
One idea is having a centralized issue tracking where compiler and library maintainers and users could post defects or ask for improvements.2) Stop using std::experimental and instead use std::alpha / std::beta (or anything that indicates how close such feature is to the final standard).Companies/teams would be more comfortable adopting and testing pre-standard features.Provide an easy to access matrix of these features but different of the current one currently on isocpp.org that only contains the proposal number and vendor/version availability it would also have:- Synopsis of motivation- A collection of practical examples- A history of the decisions around the design- Such matrix could be maintained by the community similarly as the Core Guidelines.There's no way that's going to fit into a "matrix".
Consider `std::variant`. That proposal went through a huge number of changes. And the proposals kept extensive notes documenting not only each change, but the committee votes responsible for it. The history section for some of those revisions required pages. You can't fit all of that into a "matrix".3) Library proposals should have standard implementations which compile in all major compilers compliant with the targeted standard.- I am aware this is close to a de facto requirement.- But the change is that they would be centralized in a common repository.- Library features could target an older standard if that makes sense.- People not able or not willing to switch to a new standard could use the standard implementation.- A standard implementation would stop to be maintained once part of the standard.- If modified for adhering to a subsequent standard, it's assumed to be a new proposal.4) All the ideas above use, if you will, the "github" model for driving the work around the standard.But there's still room for a "StackOverflow" model to gauge interest and/or indicate deficiencies in the final product.As soon as the model above is available the parts of the library/language with more questions are either:- The "hot" features that everyone is looking into integrating in their work.- Or, the ones lacking documentation or too difficult to be used by the average user of the language.- StackOverflow itself can be used, no need to reinvent the will.Those ideas aim to drive more people to participate in the new "maintenance" work group as well in providing feedback.Again, what kind of "participation" are you talking about? Before you can start proposing solutions, you need to explain how, in your ideal world, people would be materially contributing to C++.
They centralize the efford to make the standard happen - a single source of truth of sorts - that should be in the front page of isocpp.org.I believe this also addresses the concerns of both the camp of "C++ evolution is sluguish" and the camp of "I can't keep up with C++".Also, the experts are left alone to drive the evolution of the language every 3 years but they will be watched more closely by whole community involved in maintaining the current standard.All this is suplemental to the current communities revolving around C++ such as clang, gcc, boost, etc. They would feed from the "standard" community and vice-versa.That said, who's interested in convincing the committee and tackle this challenge? :)Fork Clang and libc++, and go start your own language split from the needs of an ISO process. You can build whatever process you want for it.
On 2017-09-14 23:43, Ricardo Fabiano de Andrade wrote:
> 1) Break the standard in two - language and library - but not literaly.
> Keep the 3-year cycle for language, have a much shorter (4-month /
> per-meeting?) cycle for library changes.
I just can't see this happening. Already, implementations lag behind the
standard, sometimes for years. Even at a three-year cycle, we're seeing
implementations struggling to have full support for the previous
standard before the next one is released.
There is also a VERY high bar for backwards compatibility. This is a
mixed blessing. On the one hand, it's important, because, unlike
stand-alone libraries, it is more difficult to use an older version of
the standard library. One can hope that their vendor develops the
standard library in a way that allows it to be used in compatibility
mode, but not all vendors do so (VS in particular comes to mind).
We need either the current, slow-to-change, long-term compatibility
model, or we need a better ecosystem of "common", granular, and
easy-to-obtain libraries more like the Python model. Both approaches
have disadvantages, which are often inherent to the problems they try to
solve.
> 2) Stop using std::experimental and instead use std::alpha / std::beta (or
> anything that indicates how close such feature is to the final standard).
> Companies/teams would be more comfortable adopting and testing pre-standard
> features.
Do you have any evidence to support this?
In my experience, the reason developers are slow to adopt new features
is usually need to support older compilers. One project I work on has
only recently moved to full C++11... 5-6 years after that standard was
published. We've only been able to do so because a) we "finally" dropped
support for Red Hat 6, and b) VS2015 finally has decent support for that
standard.
This situation may improve in the future, but if it does, it won't have
anything to do with naming conventions.
> 3) Library proposals should have standard implementations which compile in
> all major compilers compliant with the targeted standard.
> - I am aware this is close to a de facto requirement.
> - But the change is that they would be centralized in a common repository.
So, basically... you want to eliminate multiple standard library
implementations. There are advantages to that. There are also drawbacks.
You'd need an acceptable license. You'd need folks to agree to allow
compiler-specific code. You'd also need a solution for embedded
platforms, for which the full standard library is both unnecessary and
too big.
On the other hand, if we went that route, we might as well all just use
something like Qt. Per above, by the time you solve *all* the problems
that moving in this direction entails, you've basically moved from the
current C++ standard library approach to something much more like Python.
--
Matthew
People who pay the wages of software engineers are more concerned with output per engineer. Adding another core to the cluster to make up for a minuscule loss of performance due to double-indirection of pointers or whatnot is way cheaper than paying someone to play around trying to get open source graphics libraries or crypto libraries to compile.
The only way to increase the productivity of a c++ engineer to match that of a Java or Javascript dev is to give him comparably useful, standard, tools.
On Friday, 15 September 2017 23:57:16 UTC+10, Richard Hodges wrote:The only way to increase the productivity of a c++ engineer to match that of a Java or Javascript dev is to give him comparably useful, standard, tools.Why is that? Java and Javascript development *also* require going out and hunting down the appropriate libraries to get useful work done. Is it the existence of npm and Maven (is that right?) that makes the productivity difference?
On Friday, 15 September 2017 06:10:45 UTC+1, Nicol Bolas wrote:On Thursday, September 14, 2017 at 11:43:51 PM UTC-4, Ricardo Andrade wrote:Even though I totally disagree with Richard's tone in this discussion I do understand his frustration with the current status quo of C++. I felt like this myself in several occasions.Despite my admiration for the members of the committee and all the effort they put in the standard, I think there's plenty of room for improvement in a few areas.The most critical in my opinion is that the communication channel between community and committee is too narrow and therefore the feedback is insufficient.There's no clear path for trying a new library or language features.As example, it doesn't matter if string_view has been available for several years if no one knows about it, which purpose is it supposed to serve and how to use it.It's very hard for someone that doesn't follow the standard to get to know about a proposal and where to try it."Where to try it" is not something the standards committee can deal with. The committee publishes standards, not implementations.True but many developments demand implementation experience. The conscientious proposers put their implementations on an open source repository somewhereand reference it in the proposal. There is an argument that they could belong together in the same incubator.
One idea is having a centralized issue tracking where compiler and library maintainers and users could post defects or ask for improvements.2) Stop using std::experimental and instead use std::alpha / std::beta (or anything that indicates how close such feature is to the final standard).Companies/teams would be more comfortable adopting and testing pre-standard features.Provide an easy to access matrix of these features but different of the current one currently on isocpp.org that only contains the proposal number and vendor/version availability it would also have:- Synopsis of motivation- A collection of practical examples- A history of the decisions around the design- Such matrix could be maintained by the community similarly as the Core Guidelines.There's no way that's going to fit into a "matrix".Consider `std::variant`. That proposal went through a huge number of changes. And the proposals kept extensive notes documenting not only each change, but the committee votes responsible for it. The history section for some of those revisions required pages. You can't fit all of that into a "matrix".This to my mind is where issue trackers and wiki's fit in.
--
On Fri, Sep 15, 2017 at 12:10 AM, Nicol Bolas <jmck...@gmail.com> wrote:On Thursday, September 14, 2017 at 11:43:51 PM UTC-4, Ricardo Andrade wrote:Even though I totally disagree with Richard's tone in this discussion I do understand his frustration with the current status quo of C++. I felt like this myself in several occasions.Despite my admiration for the members of the committee and all the effort they put in the standard, I think there's plenty of room for improvement in a few areas.The most critical in my opinion is that the communication channel between community and committee is too narrow and therefore the feedback is insufficient.There's no clear path for trying a new library or language features.As example, it doesn't matter if string_view has been available for several years if no one knows about it, which purpose is it supposed to serve and how to use it.It's very hard for someone that doesn't follow the standard to get to know about a proposal and where to try it."Where to try it" is not something the standards committee can deal with. The committee publishes standards, not implementations.Which is very narrow way of thinking. You put a lot of effort on something for a target audience but they are never going to try it. Or worst, when they try, they hate it.That's why I am suggesting ways of bringing the community to more actively participate, to bridge this gap.
As for knowing about a proposal... I really don't know how much more the committee can do. There's an entire website whose sole purpose is to be where standard C++ news items happen. That website publishes the mailings, which contain all of the proposals in question.What more do you want?Knowing where to find the implementations of a proposal so I can try, know about the design decisions around a proposal so I can decide for myself if in favor or against it... and more importantly IN A SINGLE PLACE.Saying that std proposals mail list is this place is a extremely short sighted view of what could be done.
The committee is counting on volunteers but there's no effort to make this need explicit. Honestly, a language complex as C++ needs all the help one can get.And a language as complex as C++ needs as little of the wrong kind of help as it can get. That's really important too.First, there's no wrong kind of help.
There's a misguided effort. Again, communication is important to avoid that.Second, I am not proposing a direct democracy kind of participation.My idea is:- The community drives the new work group working on minor versions standards.- The new work group acts as a filter and as a guide for the community.- The feedback is taken to other work groups working on the major version of the standard.Finally, is committee open or not? You are contradicting your own arguments.
On the contrary, the few channels available (this one and std proposals) are very closed (and sometimes it feels unwelcoming) to the general community.I'm not sure how much more open you can get by having a forum/mailing list that literally anybody can sign up to use. The forums may be well-hidden, but once you find them, they're right here.I am sure it can get more open and that's my proposal."The forums may be well-hidden" = wrong!What are you hiding from? Uncomfortable questions? Challenged assumptions?Yes, I intend to pop your bubble!
The community gets their hands on language and library changes very late in the process.And boost can't serve much as a test bed because the experience has been proving that once something from boost passes through the committee, a whole lot changes.Most of the record of such changes and decisions is closed to the general community - because ISO doesn't allow that to be public in some cases.The majority of the community is not interested in submitting proposals. The bar is too high and it's too big of a commitment.But everyone is eager to try the "next big thing". The current process is missing all this participation.I'm not sure how useful such participation would be. If you're not able to put together a proposal... what exactly can you do to improve the standard? Ideas are easy; it's the details that are hard. And it's the details that we need.My testing the proposals in the real world. Isn't that the idea behind a TS anyway?
Again, if you want some kind of collective proposal development system, that's fine. But it still needs to lead to an actual proposal, not a bunch of ideas or functions that someone else has to cobble together into a working whole.Agreed. I am not proposing a change in the process. Just more ways to drive the process and provide feedback.So what would this participation be, providing commentary on proposals? That just requires people who have actual domain knowledge to spend their time sifting through the 90% of worthless comments for the occasional nugget of genuinely useful information. That is a huge waste of time.You just said that the C++ community is incapable of using the resulting work of the committee.That by itself is problem.Again, there must be a filter - a moderator - capable of both understand the community feedback and take it to the committee.
OK, let's wind the clocks back to 2011. C++11 is about to be published, and you're going to deprecate `auto_ptr`. And this time, you're deprecating it with the expressed idea of replacing it with `unique_ptr`. So you're serious about it.I can't do anything about the past but let's go with your arguments...Now, forget everything about how long it takes to publish another standard. If you had to pick a year, what year would you say "OK, everyone's had enough time to switch to `unique_ptr`, so we're eliminating `auto_ptr`"?The more you put in the standard the longer it takes... the longer something stays in the standard, the more it gets used and the longer it takes to deprecate it.I submit that no year before 2016 is workable. You need to be fully aware of just how much C++ code exists out there. And just how much of it needs to compile and yet isn't being actively maintained.Agreed. I am sorry if the life of library writers gets difficult by doing quick releases. But the more the community participates more people could join them.And we're talking about a drop in replacement here, where any differences between `auto_ptr` and `unique_ptr` will be obvious, noisy, and quickly resolved. And some people still complain after six years of warning.Sure, it stayed there for more than a decade.Let's say we were to deprecate the string::operator string_view() in the next year. I am pretty sure that by 2019 it could be removed.
--
Matthew
1) Break the standard in two - language and library - but not literaly.
Keep the 3-year cycle for language, have a much shorter (4-month / per-meeting?) cycle for library changes.Organize a different work group for the short cycle to not drawn resources away from the main work groups.What could be done under these short cycles:- Fixing defect reports- Improve on usabiliy and ease-of-use issues (example: make_unique)- Test library-only solutions that may demand languange additions not certain to be worth- Deprecating library features- Remove deprecated library features- Merging library TSs which do not require language changesThen offload some of this work to the community.One idea is having a centralized issue tracking where compiler and library maintainers and users could post defects or ask for improvements.
On 2017-09-15 11:06, Ricardo Fabiano de Andrade wrote:
> On Fri, Sep 15, 2017 at 8:31 AM, Matthew Woehlke wrote:
>> On the other hand, if we went that route, we might as well all just use
>> something like Qt. Per above, by the time you solve *all* the problems
>> that moving in this direction entails, you've basically moved from the
>> current C++ standard library approach to something much more like Python.
>
> I am sorry to hear that. It's the status quo speaking loudly.
> At least this was just a little bit more polite than suggesting a fork...
>
> Apparently not one is interested in solving these problems and that's very
> unfortunate.
The "impedance", if you will, between our views is that I am very much
unconvinced that having One True Monolithic Library that does everything
is actually a good thing. (You've heard the term "monopoly", I assume?
You're probably aware of its negative connotations?)
What I see as the problem isn't that "the C++ standard library can't do
X", it's that it's too hard to obtain an *existing* library that *does*
do "X".
*That* problem I am interested in solving. However, it's also somewhat
out of scope for "the C++ standard".