I mostly agree with you. I don't think a "terse" syntax is needed.
However, let's not forget something: if you cannot read/write C++ without an IDE, then C++ has got too complex for any human being. So I strongly disagree with your "ctrl-click" argument.
There are many cases where we need to read code and cannot ask an IDE (because it's a single file extracted from the project like in an email for instance).
On Tuesday, June 19, 2018 at 12:54:51 PM UTC+3, floria...@gmail.com wrote:I mostly agree with you. I don't think a "terse" syntax is needed.
However, let's not forget something: if you cannot read/write C++ without an IDE, then C++ has got too complex for any human being. So I strongly disagree with your "ctrl-click" argument.There are many cases where we need to read code and cannot ask an IDE (because it's a single file extracted from the project like in an email for instance).Honest question. Are there any case syntax is added for humans only? I can think of many places where it is removed (auto, for(:), etc ect), but not a single case where it is added.
std::vector<int> vec;
for (std::vector<int>::iterator it = vec.begin(); it != vec.end(); ++it) {
int& i = *it;
/* do some stuff with i */
}
std::vector<int> vec;
for(auto& i : vec) {
/* do some stuff with i */
}
OK, right now in flight are about FOUR proposals, trying to "simplify" and "make more clear" concepts usage.This is madness. It is madness, because NONE of it make it more clear! None.
For Simple casestemplate<Sortable S>void sort(S& s);
OK, right now in flight are about FOUR proposals, trying to "simplify" and "make more clear" concepts usage.This is madness. It is madness, because NONE of it make it more clear! None.By inviting new language constructs one does not make things "more clear", it only adds more things to learn.The worst part is - we have working solution that is clear. Granted verbose, but clear.If one makes it Not verbose but Not clear (not self-explanatory, need learning) also one gains nothing!
I don't like this. I think it overlaps too much with non-type parameters.
On Tue, Jun 19, 2018 at 10:52 AM Nicol Bolas <jmck...@gmail.com> wrote:On Tuesday, June 19, 2018 at 10:41:23 AM UTC-4, Hyman Rosen wrote:I don't like this. I think it overlaps too much with non-type parameters.Yes, it does overlap with them. But since type parameters are by far the most prevalent, let's give them the synatx they deserve.
Type parameters are by far the most prevalent, yet we nevertheless call them out as such:
template <typename SumType, typename Iter>
SumType accumulate(Iter begin, Iter end, SumType init);
The point of language design isn't to come up with the most compact syntax.
It's to have a syntax that makes code lucid to its readers.
So by analogy,
template <concept Sortable S>
void sort(S &s);
would be the way to go.
And as to your point on lambdas, they definitely should have had a keyword introducer,
(lambda is good!) and trailing return types should have been introduced by return, not
by ->. Among other things, the reluctance to break old syntax is causing new features
to be expressed as gibberish.
On Tuesday, June 19, 2018 at 5:33:54 AM UTC-4, mihailn...@gmail.com wrote:OK, right now in flight are about FOUR proposals, trying to "simplify" and "make more clear" concepts usage.This is madness. It is madness, because NONE of it make it more clear! None.By inviting new language constructs one does not make things "more clear", it only adds more things to learn.The worst part is - we have working solution that is clear. Granted verbose, but clear.If one makes it Not verbose but Not clear (not self-explanatory, need learning) also one gains nothing!Clarity is ultimately a measure of time. Variadic templates are not "clear" to people who've never seen them. UDLs are not "clear" to people who've never seen them. Lambdas are not "clear" to people who've never seen them. Structured bindings are not "clear" to people who've never seen them. And God knows rvalue references and forwarding references would utterly baffle people who've never seen them.All of these things are clear to us now because we are used to them. That's the only reason why they are clear. Your hypothetical time traveler from the C++98/03 days would be confused by the simplest of modern C++11 code.And that's OK.
Saying that a syntax is wrong just because we're not used to it is not helpful. It's far more useful to look at things from a cost/benefit analysis.Lambdas are probably the best example, because they don't do anything that you couldn't do yourself, either with in-situ struct declarations or out-of-function declarations. So their benefit is purely convenience.Lambdas have a huge syntactic cost. They have novel introduction syntax, re-appropriating something that looks like an array into a function/class declaration. They are functions that can be declared without parameters, without even `()`. They deduce the return value unless you specify otherwise. They allow `auto` in parameter lists. They can capture values/expressions in a myriad of ways. And so forth.All of this represents a syntactic variance relative to regular functions. And thus, it is a burden, a cost for entry that people have to learn.But all of those costs pale into insignificance next to the gains from the syntax. Lambdas are game-changers for C++. Pre-C++11, people would avoid simple algorithms like `transform`, because writing out the equivalent code was often easier than providing a functor. That's no longer the case.
Now, I'm not saying that any of the terse syntaxes are as valuable as lambdas are. But my point is that novel syntax should not be avoided simply because it is novel; you have to look at the benefits of it.
This is the reason why I hate concept introduction syntax. It's not that it has novel syntax; it's that the novel syntax doesn't buy much. Yes, concept introduction is shorter than the full `requires` clause. But it's not shorter enough in enough cases to be worth the syntactic burden.
The nice thing about Herb's syntax is how regular it is. It works the same everywhere. It provides the same benefit everywhere. It may be novel syntax, but it solves many problems due to its regularity. It allows you to concisely fairly obvious things.
Now, you may argue that no terse syntax is worth the syntactic burden. I rather disagree: there are too many cases where the function parameters and template parameters match each other to say that making that function declaration shorter isn't worth the time and effort. Applying concepts to variables, even function parameters, makes too much sense to not be worth pursuing.
So I'm with you that adding "concept" there is a nuisance. It would be another
"typename", where the compiler knows what you meant, but tells you to change
it anyway. So the only reason to have it would be if some compiler needs the
disambiguation.
Sill - was there ever before a syntax added just for humans and not the compiler?
I think, comments already fill the role for such superfluous tokens quite nicely.
This is a subjective call, a judgement one. The argument is that the "concept"
keyword in that position does not add any value, since it was already
understood by the developer what was meant. I agree with that, since you solve
this with naming conventions: concepts are adjectives (usually ending in
-able), concrete types are nouns.
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/19c57a60-e883-4474-b106-7ff2ebc122ee%40isocpp.org.
On Tuesday, June 19, 2018 at 5:49:49 PM UTC+3, Nicol Bolas wrote:
On Tuesday, June 19, 2018 at 5:33:54 AM UTC-4, mihailn...@gmail.com wrote:OK, right now in flight are about FOUR proposals, trying to "simplify" and "make more clear" concepts usage.This is madness. It is madness, because NONE of it make it more clear! None.By inviting new language constructs one does not make things "more clear", it only adds more things to learn.The worst part is - we have working solution that is clear. Granted verbose, but clear.If one makes it Not verbose but Not clear (not self-explanatory, need learning) also one gains nothing!Clarity is ultimately a measure of time. Variadic templates are not "clear" to people who've never seen them. UDLs are not "clear" to people who've never seen them. Lambdas are not "clear" to people who've never seen them. Structured bindings are not "clear" to people who've never seen them. And God knows rvalue references and forwarding references would utterly baffle people who've never seen them.All of these things are clear to us now because we are used to them. That's the only reason why they are clear. Your hypothetical time traveler from the C++98/03 days would be confused by the simplest of modern C++11 code.And that's OK.But the problem is we have syntax that is clear to old user, even if it is new!
Saying that a syntax is wrong just because we're not used to it is not helpful. It's far more useful to look at things from a cost/benefit analysis.Lambdas are probably the best example, because they don't do anything that you couldn't do yourself, either with in-situ struct declarations or out-of-function declarations. So their benefit is purely convenience.Lambdas have a huge syntactic cost. They have novel introduction syntax, re-appropriating something that looks like an array into a function/class declaration. They are functions that can be declared without parameters, without even `()`. They deduce the return value unless you specify otherwise. They allow `auto` in parameter lists. They can capture values/expressions in a myriad of ways. And so forth.All of this represents a syntactic variance relative to regular functions. And thus, it is a burden, a cost for entry that people have to learn.But all of those costs pale into insignificance next to the gains from the syntax. Lambdas are game-changers for C++. Pre-C++11, people would avoid simple algorithms like `transform`, because writing out the equivalent code was often easier than providing a functor. That's no longer the case.Now, I'm not saying that any of the terse syntaxes are as valuable as lambdas are. But my point is that novel syntax should not be avoided simply because it is novel; you have to look at the benefits of it.'requires' is the similar of lambdas; in place of the enable_if magic. It is new syntax, yet clear.This is the reason why I hate concept introduction syntax. It's not that it has novel syntax; it's that the novel syntax doesn't buy much. Yes, concept introduction is shorter than the full `requires` clause. But it's not shorter enough in enough cases to be worth the syntactic burden.I agree 100% obviously.The nice thing about Herb's syntax is how regular it is. It works the same everywhere. It provides the same benefit everywhere. It may be novel syntax, but it solves many problems due to its regularity. It allows you to concisely fairly obvious things.Sorry, but that syntax is literally taking the hated introduction syntax and splatting it all over the entire Concepts proposal just to be "consistent"!
void forward_func(Concept{Typename} &&t)
{
func(std::forward<Typename>(t));
}
void func(Iterator{It} first, It last)
{
}[](Iterator{It} first, It last) {...}
vs.
[]<Iterator It>(It first, It last) {...}And it is syntax for the sake of syntax because it is not technically needed - no problem to be solved.
And, as said it has nasty problems, from the fact it is not obvious in any way, to the metal overlap with initialization.Number{} x;x = Number{};And again NO PROBLEM NEEDS SOLVING! None.Now, you may argue that no terse syntax is worth the syntactic burden. I rather disagree: there are too many cases where the function parameters and template parameters match each other to say that making that function declaration shorter isn't worth the time and effort. Applying concepts to variables, even function parameters, makes too much sense to not be worth pursuing.Ok, however these are "nice" and nice things can wait, there is no pressing issue here!
Second, in 10+ years the results ARE WORSE. All of them!
Third the real community is still to have its say. Any additional syntax should wait for the real feedback and the real requirements.
Sill - was there ever before a syntax added just for humans and not the compiler?
And it is syntax for the sake of syntax because it is not technically needed - no problem to be solved.So are lambdas. As I pointed out, there is no technical reason why you cannot replace every lambda ever with a user-written type.And, as said it has nasty problems, from the fact it is not obvious in any way, to the metal overlap with initialization.Number{} x;x = Number{};And again NO PROBLEM NEEDS SOLVING! None.Now, you may argue that no terse syntax is worth the syntactic burden. I rather disagree: there are too many cases where the function parameters and template parameters match each other to say that making that function declaration shorter isn't worth the time and effort. Applying concepts to variables, even function parameters, makes too much sense to not be worth pursuing.Ok, however these are "nice" and nice things can wait, there is no pressing issue here!Concepts are "nice things" too. But I think we can all agree we've waited too long for them.
Second, in 10+ years the results ARE WORSE. All of them!... huh?Third the real community is still to have its say. Any additional syntax should wait for the real feedback and the real requirements.Every argument you make after this point against terse templates is an argument you could make against lambdas. But we still have them. Why?Because the benefits outweigh the costs.
A syntax which could be used for something else in a decade?
A syntax that does not introduce new features, but only adds second, even third way of doing the same thing?
And it is syntax for the sake of syntax because it is not technically needed - no problem to be solved.So are lambdas. As I pointed out, there is no technical reason why you cannot replace every lambda ever with a user-written type.And, as said it has nasty problems, from the fact it is not obvious in any way, to the metal overlap with initialization.Number{} x;x = Number{};And again NO PROBLEM NEEDS SOLVING! None.Now, you may argue that no terse syntax is worth the syntactic burden. I rather disagree: there are too many cases where the function parameters and template parameters match each other to say that making that function declaration shorter isn't worth the time and effort. Applying concepts to variables, even function parameters, makes too much sense to not be worth pursuing.Ok, however these are "nice" and nice things can wait, there is no pressing issue here!Concepts are "nice things" too. But I think we can all agree we've waited too long for them.Second, in 10+ years the results ARE WORSE. All of them!... huh?Third the real community is still to have its say. Any additional syntax should wait for the real feedback and the real requirements.Every argument you make after this point against terse templates is an argument you could make against lambdas. But we still have them. Why?Because the benefits outweigh the costs.Your comparison to lambdas would have been correct only if we had a concurrent terse lambda proposal being developed at the same time as the regular one.
Even worse - to have the terse lambda blocking normal lambda. Because we are there with Concepts.
Similarly, what would `template <function definition>` mean in some hypothetical future?I understand and appreciate the idea of not burning precious syntax for trivial things. But we're not talking about prime syntactic real estate here.A syntax that does not introduce new features, but only adds second, even third way of doing the same thing?It doesn't matter how many ways there are of doing something. What matters is whether those ways are clear and convenient to use. Template headers are clear but inconvenient.And it is syntax for the sake of syntax because it is not technically needed - no problem to be solved.So are lambdas. As I pointed out, there is no technical reason why you cannot replace every lambda ever with a user-written type.And, as said it has nasty problems, from the fact it is not obvious in any way, to the metal overlap with initialization.Number{} x;x = Number{};And again NO PROBLEM NEEDS SOLVING! None.Now, you may argue that no terse syntax is worth the syntactic burden. I rather disagree: there are too many cases where the function parameters and template parameters match each other to say that making that function declaration shorter isn't worth the time and effort. Applying concepts to variables, even function parameters, makes too much sense to not be worth pursuing.Ok, however these are "nice" and nice things can wait, there is no pressing issue here!Concepts are "nice things" too. But I think we can all agree we've waited too long for them.Second, in 10+ years the results ARE WORSE. All of them!... huh?Third the real community is still to have its say. Any additional syntax should wait for the real feedback and the real requirements.Every argument you make after this point against terse templates is an argument you could make against lambdas. But we still have them. Why?Because the benefits outweigh the costs.Your comparison to lambdas would have been correct only if we had a concurrent terse lambda proposal being developed at the same time as the regular one.But they did. Go look at some of the old lambda proposals. There were ideas about dropping the parameter typename identifiers and so forth even back then. They didn't pan out, but there was discussion about them concurrently with the broader lambda syntax. And such things would have been optional rather than mandatory.Even worse - to have the terse lambda blocking normal lambda. Because we are there with Concepts.Since when has terse templates blocked concepts? The Concepts TS wasn't ready for C++17; questions about terse syntax were just one of the reasons why. And Concepts-sans-terse syntax was voted into C++20 last year. So we aren't "there" at all.Not unless one of the 5 national bodies is threatening not to vote for C++20 without some form of terse templates.
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f866bc73-ddd3-43a6-82db-b977c90c09b1%40isocpp.org.
On Tuesday, June 19, 2018 at 10:15:35 PM UTC+3, Nicol Bolas wrote:On Tuesday, June 19, 2018 at 2:48:17 PM UTC-4, mihailn...@gmail.com wrote:Are they significant enough to add de facto brand new syntax?That's a judgement call, but I would say "yes".A syntax which could be used for something else in a decade?OK, so let's review the two syntaxes in question (because the committee has essentially boiled them down to just two).There's Herb's proposal, which is `ConceptName{stuff}`. And there's the Concepts TS terse syntax but with `template` applied to functions that use them (except for lambdas which get it without `template`).What could you use `ConceptName{stuff}` for in the future? Do you have any ideas at all where such syntax might be useful?Something{stuff} was already considered for structured bindings.
I don't know what the future holds, but we are clearly chipping away syntax ground just for an alternative.
In any case Concepts-sans-terse is not frozen. And that is what worries me.
On Tuesday, June 19, 2018 at 4:57:07 PM UTC-4, mihailn...@gmail.com wrote:On Tuesday, June 19, 2018 at 10:15:35 PM UTC+3, Nicol Bolas wrote:On Tuesday, June 19, 2018 at 2:48:17 PM UTC-4, mihailn...@gmail.com wrote:Are they significant enough to add de facto brand new syntax?That's a judgement call, but I would say "yes".A syntax which could be used for something else in a decade?OK, so let's review the two syntaxes in question (because the committee has essentially boiled them down to just two).There's Herb's proposal, which is `ConceptName{stuff}`. And there's the Concepts TS terse syntax but with `template` applied to functions that use them (except for lambdas which get it without `template`).What could you use `ConceptName{stuff}` for in the future? Do you have any ideas at all where such syntax might be useful?Something{stuff} was already considered for structured bindings.I don't know what the future holds, but we are clearly chipping away syntax ground just for an alternative.So your hypothetical is a syntax that was considered and rejected on grounds having nothing to do with concepts. So if concepts had used it, it would still have been rejected, just with one more reason to do so.I'm having a problem seeing the potential in this syntax.Again, I recognize the importance of not spending syntax just because it's there. Generally. But we're not talking about "generally"; we're talking about a specific piece of syntax. If there is some potential competition for this syntax that could be more useful, that'd be one thing. But if there is no such competition, and we can solve a bunch of (relatively minor) problems using this syntax, then I say take it.
Unused syntax helps nobody.In any case Concepts-sans-terse is not frozen. And that is what worries me.Are you also worried that contracts aren't frozen either? Or that ranges isn't frozen? Or `operator<=>` isn't frozen yet?They're not frozen because C++20 is not frozen. That's how standards are developed. Concepts is decoupled from terse syntax; one is in, and the other is out.
[]<Concept C1, Concept C2>(C1 &c1, const C2 &c2) {...}
Rather than
[](Concept &c1, const Concept &c2) {...}
Or
[](Concept{} &c1, const Concept{} &c2) {...}Let me put it a different way. Do you really want to have to write this to have a conceptualized lambda:[]<Concept C1, Concept C2>(C1 &c1, const C2 &c2) {...}
Rather than
[](Concept &c1, const Concept &c2) {...}
Or
[](Concept{} &c1, const Concept{} &c2) {...}Why is the first one better than the second or third? What is all of that verbiage providing?
On Wednesday, June 20, 2018 at 2:46:56 AM UTC-4, mihailn...@gmail.com wrote:On Wednesday, June 20, 2018 at 1:32:55 AM UTC+3, Nicol Bolas wrote:On Tuesday, June 19, 2018 at 4:57:07 PM UTC-4, mihailn...@gmail.com wrote:On Tuesday, June 19, 2018 at 10:15:35 PM UTC+3, Nicol Bolas wrote:On Tuesday, June 19, 2018 at 2:48:17 PM UTC-4, mihailn...@gmail.com wrote:In any case Concepts-sans-terse is not frozen. And that is what worries me.Are you also worried that contracts aren't frozen either? Or that ranges isn't frozen? Or `operator<=>` isn't frozen yet?They're not frozen because C++20 is not frozen. That's how standards are developed. Concepts is decoupled from terse syntax; one is in, and the other is out.I *wish* that was the case, but "the other" is not 'out' - it is still actively pursued. Hence this topic.My wish is to have this discussion after C++ 23 instead.Your earlier statement suggested that you were concerned that terse syntax was interferring with the rest of concepts being shipped: "Even worse - to have the terse lambda blocking normal lambda. Because we are there with Concepts."But now, you're saying that you're not concerned with when the rest of concepts is shipped. You're merely concerned that terse syntax exists at all. That people are working on trying to get a feature into the standard that you don't want.
Let me put it a different way. Do you really want to have to write this to have a conceptualized lambda:[]<Concept C1, Concept C2>(C1 &c1, const C2 &c2) {...}
Rather than
[](Concept &c1, const Concept &c2) {...}
Or
[](Concept{} &c1, const Concept{} &c2) {...}Why is the first one better than the second or third? What is all of that verbiage providing?
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/becbeb5f-cd4f-40df-998c-10f849a6a3fe%40isocpp.org.
I have an issue with reserving Concept{} because that means "create an archetype of Concept, substituting no archetype free variables" to me.
Archetypes will be important at some point, or at least I hope so - they are really important for completion and body-checking, and when you have that, why not be able to use them in unevaluated contexts?
On Wednesday, June 20, 2018 at 3:42:29 PM UTC-4, Gašper Ažman wrote:I have an issue with reserving Concept{} because that means "create an archetype of Concept, substituting no archetype free variables" to me.OK, but what is an "archetype of Concept", and why would most C++ programmers think that this syntax means that?
Archetypes will be important at some point, or at least I hope so - they are really important for completion and body-checking, and when you have that, why not be able to use them in unevaluated contexts?Because certain members of the committee have made it abundantly clear that "Concepts" in C++ will never go beyond their current constraints. There will be no "completion and body-checking" in C++. Ever.
On Wednesday, June 20, 2018 at 7:44:58 PM UTC+3, Nicol Bolas wrote:On Wednesday, June 20, 2018 at 2:46:56 AM UTC-4, mihailn...@gmail.com wrote:I *wish* that was the case, but "the other" is not 'out' - it is still actively pursued. Hence this topic.My wish is to have this discussion after C++ 23 instead.Your earlier statement suggested that you were concerned that terse syntax was interferring with the rest of concepts being shipped: "Even worse - to have the terse lambda blocking normal lambda. Because we are there with Concepts."But now, you're saying that you're not concerned with when the rest of concepts is shipped. You're merely concerned that terse syntax exists at all. That people are working on trying to get a feature into the standard that you don't want.I am not concerned when the rest will ship if ever,
I even think it is better to postpone (so Concepts are not slowed... or worse) and get some real feedback.
Let me put it a different way. Do you really want to have to write this to have a conceptualized lambda:[]<Concept C1, Concept C2>(C1 &c1, const C2 &c2) {...}
Rather than
[](Concept &c1, const Concept &c2) {...}
Or
[](Concept{} &c1, const Concept{} &c2) {...}Why is the first one better than the second or third? What is all of that verbiage providing?I personally have no problem with either 1 or 2.
And BTW the last example should be [](Concept{C1} &c1, const Concept{C2} &c2) {…} to match the first, otherwise the {} will surely be optional (as the proposal anticipates)
This is new language - new syntax and new idioms - 2-in-1 instructions. (again, putting aside the mental overlap with object creation)All this right after we doubled down on the 30 years old name introducing syntax - <Type Name> - with lambdas as well!And I ask again - what is the problem of having comma separated template arguments <Concept C1, C2> ?
And if we want the required statement to be able to also introduce, why does it need brand new syntax?
instead ofMergeable{In1, In2, Out}Out merge(In1,In1,In2,In2,Out);justrequires Mergeable<In1, In2, Out>Out merge(In1,In1,In2,In2,Out);No new syntax AND it is clear we are starting a template.
Mergeable{Out, In1, In2} merge(In1, In1, In2, In2, Out);On Wed, Jun 20, 2018 at 8:51 PM, Nicol Bolas <jmck...@gmail.com> wrote:On Wednesday, June 20, 2018 at 3:42:29 PM UTC-4, Gašper Ažman wrote:I have an issue with reserving Concept{} because that means "create an archetype of Concept, substituting no archetype free variables" to me.OK, but what is an "archetype of Concept", and why would most C++ programmers think that this syntax means that?An archetype of a concept is a fictional concrete type that satisfies the syntactic constraints. Under certain conditions it can be generated from the concept specification, thus enabling completion.
Body checking might be warning only, but that doesn't mean it isn't useful.Archetypes will be important at some point, or at least I hope so - they are really important for completion and body-checking, and when you have that, why not be able to use them in unevaluated contexts?Because certain members of the committee have made it abundantly clear that "Concepts" in C++ will never go beyond their current constraints. There will be no "completion and body-checking" in C++. Ever.People's opinions change, especially in the face of evidence. Even if the past proposals weren't acceptable, why does that prohibit it in the future? If we can make it work in a way that's "right" for C++, why kill it now, before we've had the chance to do that?
The reason that syntax means Archetype to me is because Type{} is an instantiation,
On Wednesday, June 20, 2018 at 2:54:47 PM UTC-4, mihailn...@gmail.com wrote:On Wednesday, June 20, 2018 at 7:44:58 PM UTC+3, Nicol Bolas wrote:On Wednesday, June 20, 2018 at 2:46:56 AM UTC-4, mihailn...@gmail.com wrote:I *wish* that was the case, but "the other" is not 'out' - it is still actively pursued. Hence this topic.My wish is to have this discussion after C++ 23 instead.Your earlier statement suggested that you were concerned that terse syntax was interferring with the rest of concepts being shipped: "Even worse - to have the terse lambda blocking normal lambda. Because we are there with Concepts."But now, you're saying that you're not concerned with when the rest of concepts is shipped. You're merely concerned that terse syntax exists at all. That people are working on trying to get a feature into the standard that you don't want.I am not concerned when the rest will ship if ever,When I said "rest", I meant the "non-terse template" part.I even think it is better to postpone (so Concepts are not slowed... or worse) and get some real feedback.But we have "real feedback". It's not like terse syntax manifested ex-nihilo sometime in 2017. It's out there in the Concepts TS, which is being used by real people.
Let me put it a different way. Do you really want to have to write this to have a conceptualized lambda:[]<Concept C1, Concept C2>(C1 &c1, const C2 &c2) {...}
Rather than
[](Concept &c1, const Concept &c2) {...}
Or
[](Concept{} &c1, const Concept{} &c2) {...}Why is the first one better than the second or third? What is all of that verbiage providing?I personally have no problem with either 1 or 2.Then why does the title of this thread call Bjarne's proposal "madness"? If you wanted to rail against Herb's proposal, then you should have focused on that specifically.
And BTW the last example should be [](Concept{C1} &c1, const Concept{C2} &c2) {…} to match the first, otherwise the {} will surely be optional (as the proposal anticipates)Anticipation isn't the same thing as "gonna happen". Because once you make those curly braces optional, you lose the ability to easily tell whether a function is a template or not. Which was the primary problem being resolved.
This is new language - new syntax and new idioms - 2-in-1 instructions. (again, putting aside the mental overlap with object creation)All this right after we doubled down on the 30 years old name introducing syntax - <Type Name> - with lambdas as well!And I ask again - what is the problem of having comma separated template arguments <Concept C1, C2> ?Because it doesn't make things shorter. Not by nearly as much. We're talking about creating syntax that lets you see what's going on without so much text. Dropping a single word like that isn't helping.
And if we want the required statement to be able to also introduce, why does it need brand new syntax?Wait: I thought the reason you hated Herb's syntax was because it is a novel syntax. How is using `requires` to preemptively create a template any less novel?
instead ofMergeable{In1, In2, Out}Out merge(In1,In1,In2,In2,Out);justrequires Mergeable<In1, In2, Out>Out merge(In1,In1,In2,In2,Out);No new syntax AND it is clear we are starting a template.But nobody's suggesting that. Well OK, Bjarne is probably still hoping concept introduction syntax will make it in, but Herb's proposal doesn't do that. It does this:
Mergeable{Out, In1, In2} merge(In1, In1, In2, In2, Out);That is, you define `Mergeable` such that it is the output type. So it's not some special syntax that begins a template function declaration. It behaves no differently than any other use of a concept for a function's output parameter, while simultaneously naming some of its template parameters for use as function parameter types.
template <class T> constexpr bool foo();
template <class T> constexpr bool bar();
template <class T> concept Foo = foo<T>();
template <class T> concept FooBar = Foo<T> && bar<T>();
Ok, I was reading some old papers on the then-called Concepts Light and then it hit me.Terse syntax have nothing to do with Concepts! And It never had. It was a feature creep from the beginning, an additional goal, the goal to have generic code expressed naturally.This goal however has nothing to do with Concepts as the goal for Concepts is to have constrained types and nothing more.
The goal of generic code expressed naturally is unrelated - you might want unconstrained types expressed naturally.
But, before concepts we didn't have "natural" templates! We didn't have func(auto) or some func(class{}) for 30 years
This is were ALL the problems stem from - the fact we try to "evolve" natural syntax, but there is no base to evolve from!As a result we create jump, a discontinuation, which either leads to the so called "natural" syntax looking more alien then templates themselves (incl. introducing new constructs).orWe got confused "is auto func(Searchabe&)" a template. It is normal to be confused - there is no continuous evolution. We/some resist the discontinuation.On the other hand Concepts, as an integral part of the template system do fit - it is a smooth evolution in both syntax and meaning.
And it goes the other direction - because natural has nothing to do with Concepts, the syntax MUST work with unconstrained as well. We MUST have func(auto) or func(class{T});
With all that out of the way, I intended to write a proposal to not include any terse syntax for 20. Now I don't have a shadow of doubt this is The Right Thing (for now). Luckily (not that it s luck!) the current working paper does not includes any of it.
To iterate, I am not against natural, butit MUST be tackled as separate problem,
it MUST be decupled from Concepts (physically and mentally)
it MUST be tackled AFTER Concepts and
it MUST handle unconstrained as well.
On Thursday, June 21, 2018 at 10:55:38 AM UTC-4, mihailn...@gmail.com wrote:Ok, I was reading some old papers on the then-called Concepts Light and then it hit me.Terse syntax have nothing to do with Concepts! And It never had. It was a feature creep from the beginning, an additional goal, the goal to have generic code expressed naturally.This goal however has nothing to do with Concepts as the goal for Concepts is to have constrained types and nothing more.That's one way to express it. Another way to express the goal of the Concepts-lite proposal is to improve the ability of users to constrain templates. That involves two pieces: how to define constraints and how to apply them. "Natural syntax" is about application, and therefore falls under its purview.
template<Concept T> ...;template<typename T> requires Concept<T> ...;
On Thursday, June 21, 2018 at 11:40:08 AM UTC-4, Nicol Bolas wrote:On Thursday, June 21, 2018 at 10:55:38 AM UTC-4, mihailn...@gmail.com wrote:Ok, I was reading some old papers on the then-called Concepts Light and then it hit me.Terse syntax have nothing to do with Concepts! And It never had. It was a feature creep from the beginning, an additional goal, the goal to have generic code expressed naturally.This goal however has nothing to do with Concepts as the goal for Concepts is to have constrained types and nothing more.That's one way to express it. Another way to express the goal of the Concepts-lite proposal is to improve the ability of users to constrain templates. That involves two pieces: how to define constraints and how to apply them. "Natural syntax" is about application, and therefore falls under its purview.This is a point I wanted to elaborate on further.Concepts-lite did not have to allow this:template<Concept T> ...;It could have required you to use an explicit requires clause:template<typename T> requires Concept<T> ...;That would have been the bare minimum feature: requires clauses applying concepts.But the proposal didn't stop there; it allowed you to apply a concept to a template parameter directly. It even implicitly instantiates that concept without needing <>. Back when function concepts were allowed/required, it even implicitly called the function.
Those are all usability enhancements: they make applying a concept to a template easier and more digestible.Natural syntax is merely another form of usability enhancement. If the replacing of `typename` with a type concept is reasonable for Concepts-lite, then so too is the consideration of other usability enhancements. Even ones that remove `template` boilerplate.
On Thursday, June 21, 2018 at 10:55:38 AM UTC-4, mihailn...@gmail.com wrote:Ok, I was reading some old papers on the then-called Concepts Light and then it hit me.Terse syntax have nothing to do with Concepts! And It never had. It was a feature creep from the beginning, an additional goal, the goal to have generic code expressed naturally.This goal however has nothing to do with Concepts as the goal for Concepts is to have constrained types and nothing more.That's one way to express it. Another way to express the goal of the Concepts-lite proposal is to improve the ability of users to constrain templates. That involves two pieces: how to define constraints and how to apply them. "Natural syntax" is about application, and therefore falls under its purview.
The goal of generic code expressed naturally is unrelated - you might want unconstrained types expressed naturally.You almost never want truly unconstrained types. Seriously, show me a template that genuinely imposes no constraints on its argument. It happens, but not very often. `any`'s constructor requires that `T` is CopyConstructible. Even `emplace` requires that the sequence of parameters can be forwarded to `allocator::construct`.We use unconstrained types mainly because constraining them requires lots of effort. The goal of concepts is to minimize that effort. The fruits of that goal is the ability to express those constraints "naturally".
So to say that constraints and "natural syntax" are unrelated is misleading. The existence of constraints makes "natural syntax" useful, readable, and digestible. And "natural syntax" makes constraint application more useable, readable, and digestible.
The two are closely associated.Unconstrained "natural syntax" is just porting lambda's use of `auto` parameters to regular functions. And doing only that is just not worth the effort, not in a world where constraints exist as a feature.But, before concepts we didn't have "natural" templates! We didn't have func(auto) or some func(class{}) for 30 years[](auto foo) {...}This is were ALL the problems stem from - the fact we try to "evolve" natural syntax, but there is no base to evolve from!As a result we create jump, a discontinuation, which either leads to the so called "natural" syntax looking more alien then templates themselves (incl. introducing new constructs).orWe got confused "is auto func(Searchabe&)" a template. It is normal to be confused - there is no continuous evolution. We/some resist the discontinuation.On the other hand Concepts, as an integral part of the template system do fit - it is a smooth evolution in both syntax and meaning.
And it goes the other direction - because natural has nothing to do with Concepts, the syntax MUST work with unconstrained as well. We MUST have func(auto) or func(class{T});Why? I mean sure, it'd be nice, but we can get unconstrained behavior with `template<typename T> concept all = true;`. I'm not formally against the use of `auto`, but that's primarily because lambdas set the precedent. Personally, if there were no generic lambdas, then I would say that `auto` is the wrong keyword because it doesn't work like `auto` normally does in deduction.If we could switch to a named "unconstrained" constraint rather than `auto`, I think that would be better.Also, `class` implies a constraint: that the type is a class. That's why I prefer `typename` in templates over `class`, even though they technically mean the same thing.With all that out of the way, I intended to write a proposal to not include any terse syntax for 20. Now I don't have a shadow of doubt this is The Right Thing (for now). Luckily (not that it s luck!) the current working paper does not includes any of it.And luckily, most of the committee seems to disagree, since they're moving forward with these proposals. I highly doubt you're going to convince them that the very idea of terse syntax is not related to concepts, or that they should abandon the idea.
To iterate, I am not against natural, butit MUST be tackled as separate problem,It already is a separate problem. Suggesting that people keep doing the thing they're already doing isn't useful.it MUST be decupled from Concepts (physically and mentally)See above.
it MUST be tackled AFTER Concepts andWe already are "AFTER Concepts".
it MUST handle unconstrained as well.Ignoring the fact that you can have a `template<typename T> concept all = true;` to get "unconstrained", Bjarne's syntax already does. Nobody is ignoring "unconstrained" cases.
On Thursday, June 21, 2018 at 6:46:19 PM UTC+3, Nicol Bolas wrote:
On Thursday, June 21, 2018 at 11:40:08 AM UTC-4, Nicol Bolas wrote:On Thursday, June 21, 2018 at 10:55:38 AM UTC-4, mihailn...@gmail.com wrote:Ok, I was reading some old papers on the then-called Concepts Light and then it hit me.Terse syntax have nothing to do with Concepts! And It never had. It was a feature creep from the beginning, an additional goal, the goal to have generic code expressed naturally.This goal however has nothing to do with Concepts as the goal for Concepts is to have constrained types and nothing more.That's one way to express it. Another way to express the goal of the Concepts-lite proposal is to improve the ability of users to constrain templates. That involves two pieces: how to define constraints and how to apply them. "Natural syntax" is about application, and therefore falls under its purview.
This is a point I wanted to elaborate on further.Concepts-lite did not have to allow this:template<Concept T> ...;It could have required you to use an explicit requires clause:template<typename T> requires Concept<T> ...;That would have been the bare minimum feature: requires clauses applying concepts.But the proposal didn't stop there; it allowed you to apply a concept to a template parameter directly. It even implicitly instantiates that concept without needing <>. Back when function concepts were allowed/required, it even implicitly called the function.
This does not introduce natural syntax. It builds on templates machinery. I am not against shortcuts. Natural is much more then that however.Those are all usability enhancements: they make applying a concept to a template easier and more digestible.Natural syntax is merely another form of usability enhancement. If the replacing of `typename` with a type concept is reasonable for Concepts-lite, then so too is the consideration of other usability enhancements. Even ones that remove `template` boilerplate.It is obviously not that simple as "merely another form". If it was, then there would have been no issues. But exactly because we cross a boundary outside templates, outside what we used for 30 years, we can't agree how to proceed and the opinions vary greatly - from minimalistic to new templates syntax.
It is better to see and accepts there is boundary, then to pretend there is some sort of "natural evolution" that happens to "suddenly" not be so natural for many people.
On Thursday, June 21, 2018 at 6:40:08 PM UTC+3, Nicol Bolas wrote:On Thursday, June 21, 2018 at 10:55:38 AM UTC-4, mihailn...@gmail.com wrote:Ok, I was reading some old papers on the then-called Concepts Light and then it hit me.Terse syntax have nothing to do with Concepts! And It never had. It was a feature creep from the beginning, an additional goal, the goal to have generic code expressed naturally.This goal however has nothing to do with Concepts as the goal for Concepts is to have constrained types and nothing more.That's one way to express it. Another way to express the goal of the Concepts-lite proposal is to improve the ability of users to constrain templates. That involves two pieces: how to define constraints and how to apply them. "Natural syntax" is about application, and therefore falls under its purview.Hold on, what are the two pieces. Define and Apply. "to improve the ability of users to constrain templates", where I assume natural syntax fall in is a third goal.
The goal of generic code expressed naturally is unrelated - you might want unconstrained types expressed naturally.You almost never want truly unconstrained types. Seriously, show me a template that genuinely imposes no constraints on its argument. It happens, but not very often. `any`'s constructor requires that `T` is CopyConstructible. Even `emplace` requires that the sequence of parameters can be forwarded to `allocator::construct`.We use unconstrained types mainly because constraining them requires lots of effort. The goal of concepts is to minimize that effort. The fruits of that goal is the ability to express those constraints "naturally".Prototyping, teaching, consistency. Unconstrained are hare to stay as a baseline.
So to say that constraints and "natural syntax" are unrelated is misleading. The existence of constraints makes "natural syntax" useful, readable, and digestible. And "natural syntax" makes constraint application more useable, readable, and digestible.First, there is no such thing as "natural syntax" as we cant agree what it looks like.
Second, the benefits of Concepts alone are so massive that anyone will gladly use them as they are now.No one, ever, will boycott them because the lack of some magical syntax. Why? Because they use the same old syntax one is using for ages!
Natural syntax is not related to Concepts directly, it is related to Temples and generic programming.The desire to have natural syntax will not disappear if Concepts are not used and, with few expectations, it is not greater if Concepts are used.
With all that out of the way, I intended to write a proposal to not include any terse syntax for 20. Now I don't have a shadow of doubt this is The Right Thing (for now). Luckily (not that it s luck!) the current working paper does not includes any of it.
And luckily, most of the committee seems to disagree, since they're moving forward with these proposals. I highly doubt you're going to convince them that the very idea of terse syntax is not related to concepts, or that they should abandon the idea.
They agree, there is a clear boundary.
They can't agree on syntax and the differences are not minor, but major, diametrical.
Natural syntax is only partially related to Concepts, and is bigger then we think - it does not flow naturally (that much was proven), it must be invented, it is a different topic.I am not for abandoned, but for it to be separate topic, not against current Concepts WP and on later date so the 99% can give feedback.
To iterate, I am not against natural, butit MUST be tackled as separate problem,It already is a separate problem. Suggesting that people keep doing the thing they're already doing isn't useful.it MUST be decupled from Concepts (physically and mentally)See above.Then why are natural syntax proposals against Concepts WP?
Why it is officially listed as "issues with Concepts".
it MUST be tackled AFTER Concepts andWe already are "AFTER Concepts".Are we?Concepts are not only not released, they are still worked on. And by worked on I mean real issues like the Constraining Concepts Overload Sets proposal
On Thursday, June 21, 2018 at 12:37:03 PM UTC-4, mihailn...@gmail.com wrote:On Thursday, June 21, 2018 at 6:46:19 PM UTC+3, Nicol Bolas wrote:On Thursday, June 21, 2018 at 11:40:08 AM UTC-4, Nicol Bolas wrote:On Thursday, June 21, 2018 at 10:55:38 AM UTC-4, mihailn...@gmail.com wrote:Ok, I was reading some old papers on the then-called Concepts Light and then it hit me.Terse syntax have nothing to do with Concepts! And It never had. It was a feature creep from the beginning, an additional goal, the goal to have generic code expressed naturally.This goal however has nothing to do with Concepts as the goal for Concepts is to have constrained types and nothing more.That's one way to express it. Another way to express the goal of the Concepts-lite proposal is to improve the ability of users to constrain templates. That involves two pieces: how to define constraints and how to apply them. "Natural syntax" is about application, and therefore falls under its purview.This is a point I wanted to elaborate on further.Concepts-lite did not have to allow this:template<Concept T> ...;It could have required you to use an explicit requires clause:template<typename T> requires Concept<T> ...;That would have been the bare minimum feature: requires clauses applying concepts.But the proposal didn't stop there; it allowed you to apply a concept to a template parameter directly. It even implicitly instantiates that concept without needing <>. Back when function concepts were allowed/required, it even implicitly called the function.This does not introduce natural syntax. It builds on templates machinery. I am not against shortcuts. Natural is much more then that however.Those are all usability enhancements: they make applying a concept to a template easier and more digestible.Natural syntax is merely another form of usability enhancement. If the replacing of `typename` with a type concept is reasonable for Concepts-lite, then so too is the consideration of other usability enhancements. Even ones that remove `template` boilerplate.It is obviously not that simple as "merely another form". If it was, then there would have been no issues. But exactly because we cross a boundary outside templates, outside what we used for 30 years, we can't agree how to proceed and the opinions vary greatly - from minimalistic to new templates syntax.Let me see if I've got this right. Terse syntax is not "merely another form" of usability enhancements. Why? Because if it trust were just that, there wouldn't be arguments about what form it should take.By that reasoning, `template<Concept T>` is not "merely another form" either. Why? Because we have people in this very thread who have argued that it ought to be `template<auto<Concept> T>`. There have been actual proposals for `template<Concept typename T>` (thankfully, they were expurgated). So there are arguments about what this form should take.And therefore, by your reasoning, it is not "merely another form" of "Apply". So which is it? Will you accept that we should also ditch `template<Concept T>`? Or can we agree that disagreement alone does not represent some kind of "boundary outside template"?
It is better to see and accepts there is boundary, then to pretend there is some sort of "natural evolution" that happens to "suddenly" not be so natural for many people.Nobody is "suddenly" anything. People have had concerns about Bjarne's "natural syntax" since its inception.On Thursday, June 21, 2018 at 1:58:18 PM UTC-4, mihailn...@gmail.com wrote:On Thursday, June 21, 2018 at 6:40:08 PM UTC+3, Nicol Bolas wrote:On Thursday, June 21, 2018 at 10:55:38 AM UTC-4, mihailn...@gmail.com wrote:Ok, I was reading some old papers on the then-called Concepts Light and then it hit me.Terse syntax have nothing to do with Concepts! And It never had. It was a feature creep from the beginning, an additional goal, the goal to have generic code expressed naturally.This goal however has nothing to do with Concepts as the goal for Concepts is to have constrained types and nothing more.That's one way to express it. Another way to express the goal of the Concepts-lite proposal is to improve the ability of users to constrain templates. That involves two pieces: how to define constraints and how to apply them. "Natural syntax" is about application, and therefore falls under its purview.Hold on, what are the two pieces. Define and Apply. "to improve the ability of users to constrain templates", where I assume natural syntax fall in is a third goal.You misunderstood my meaning. "To improve the ability of users to constrain templates" is why concepts exists at all. It is the very goal of concepts."Define and Apply" are the means to achieve that goal; they are not the goal itself. My point is that "natural syntax" is within that goal; therefore, it is a perfectly reasonable thing for the Concepts proposal to include. It is not out-of-bounds, it is not scope creep or anything of the sort.
The goal of generic code expressed naturally is unrelated - you might want unconstrained types expressed naturally.You almost never want truly unconstrained types. Seriously, show me a template that genuinely imposes no constraints on its argument. It happens, but not very often. `any`'s constructor requires that `T` is CopyConstructible. Even `emplace` requires that the sequence of parameters can be forwarded to `allocator::construct`.We use unconstrained types mainly because constraining them requires lots of effort. The goal of concepts is to minimize that effort. The fruits of that goal is the ability to express those constraints "naturally".Prototyping, teaching, consistency. Unconstrained are hare to stay as a baseline.Where I come from, you start by creating an interface. In class hierarchies, that means a base class with pure virtual functions. With static polymorphism, that now means creating a concept.Any good teacher should start teaching static polymorphism with concepts. New users should be taught that unconstrained templates exist but should be avoided. And any decent prototype will have a prototype interface too, expressed as a concept.Now sure, you're still going to need `<typename T>`, but this will be for cases where `T` needs to be constrained by a `requires` clause. Truly unconstrained template parameters ought to go the way of the Dodo.
So to say that constraints and "natural syntax" are unrelated is misleading. The existence of constraints makes "natural syntax" useful, readable, and digestible. And "natural syntax" makes constraint application more useable, readable, and digestible.First, there is no such thing as "natural syntax" as we cant agree what it looks like.Yes there is. The term "natural syntax" comes directly from Bjarne Stroustrup and specifically refers to the Concepts TS proposal's terse syntax. Indeed, you were the first one to bring the term up, precisely because the early Concepts TS proposals referred to that syntax as "natural syntax".What is being debated by the committee is what terse syntax will look like: Bjarne's "natural syntax" or Herb's alternative form.And even then, there is clear agreement on the basic principle behind terse templates: you replace a parameter typename and/or output value with a concept name; this causes the parameter/output value to be deduced via a constrained template/return value deduction. So the general look of the concept is well understood. The differences, while significant, are not that huge.Second, the benefits of Concepts alone are so massive that anyone will gladly use them as they are now.No one, ever, will boycott them because the lack of some magical syntax. Why? Because they use the same old syntax one is using for ages!Who are you arguing with? Nobody claimed that people would avoid concepts because of a lack of "natural syntax". Just because people will use a feature anyway does not mean we can't make it more readable and easier to use.Producing the bare minimum when you can do more and better than that doesn't make sense.Natural syntax is not related to Concepts directly, it is related to Temples and generic programming.The desire to have natural syntax will not disappear if Concepts are not used and, with few expectations, it is not greater if Concepts are used.With all that out of the way, I intended to write a proposal to not include any terse syntax for 20. Now I don't have a shadow of doubt this is The Right Thing (for now). Luckily (not that it s luck!) the current working paper does not includes any of it.And luckily, most of the committee seems to disagree, since they're moving forward with these proposals. I highly doubt you're going to convince them that the very idea of terse syntax is not related to concepts, or that they should abandon the idea.They agree, there is a clear boundary.No, they agree that terse syntax needs more discussion and has issues to be worked out compared to the rest of concepts.
They did not agree that terse syntax is unrelated to concepts, or that terse syntax should be abandoned or delayed.They can't agree on syntax and the differences are not minor, but major, diametrical."Can't" is a far cry from "haven't". The latter is true; the former has yet to be determined.Natural syntax is only partially related to Concepts, and is bigger then we think - it does not flow naturally (that much was proven), it must be invented, it is a different topic.I am not for abandoned, but for it to be separate topic, not against current Concepts WP and on later date so the 99% can give feedback.Who is this 99% who are incapable of giving feedback on Concepts TS, but will be capable of giving feedback in a few years? Indeed, the entire terse syntax discussion is feedback on the "natural syntax" in Concepts TS.
Why is that feedback insufficient? Why do you treat terse syntax as though it's some novel thing that nobody has ever heard of before? It's been over four years since the concepts-lite effort started.To iterate, I am not against natural, butit MUST be tackled as separate problem,It already is a separate problem. Suggesting that people keep doing the thing they're already doing isn't useful.it MUST be decupled from Concepts (physically and mentally)See above.Then why are natural syntax proposals against Concepts WP?I don't know what you mean by "Concepts WP". The terse syntax proposals are EWG proposals, not proposals against the Concepts TS.Why it is officially listed as "issues with Concepts".Because terse templates come from the Concepts TS. Therefore, adjustments to issues relating to the Concepts TS are issues with concepts.it MUST be tackled AFTER Concepts andWe already are "AFTER Concepts".Are we?Concepts are not only not released, they are still worked on. And by worked on I mean real issues like the Constraining Concepts Overload Sets proposalWe are as "AFTER Concepts" as it is reasonable to get. Unless you are suggesting that there will be design changes to concepts that will impact terse syntax, there is no problem moving forward with both terse syntax discussions and tweaks to the concepts feature.Again, I don't know what it is that you're so concerned about here. What are you afraid will happen if the committee continues to debate these proposals (besides your technical issues with Herb's proposal)? Why do you feel it is necessary to shut down all discussion in this area?
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/edad4445-0238-4043-aae6-c7d7b810c2e8%40isocpp.org.
OK, right now in flight are about FOUR proposals, trying to "simplify" and "make more clear" concepts usage.This is madness. It is madness, because NONE of it make it more clear! None.By inviting new language constructs one does not make things "more clear", it only adds more things to learn.The worst part is - we have working solution that is clear. Granted verbose, but clear.If one makes it Not verbose but Not clear (not self-explanatory, need learning) also one gains nothing!
Considertemplate<Iterator Iter1, Iterator Iter2>requires Comparable_though_iterators<Iter1, Iter2>bool equal(Iter1 first, Iter1 last, Iter2){}This code is clear to ANYONE who EVER worked with C++, even to a time traveler from 30 years ago!Comparable_through_iterators{Iter1,Iter2}bool equal(Iter1 first, Iter1 last, Iter2){}This is NOT clear!First Comparable_ can be confused with a return type when one starts to read.Second The syntax is COMPLETELY alien to templates - de facto new language.Third there is no obvious connection b/w the function and the clause - it just sits there like a separate declarationForth Automatic names introductions is very uncommon and will be confusing for sure.The gain of one-less-line is DWARFED by the HEAP of "new stuff" that does NOT grant "new powers"!--- Let's continueBetweenvoid sort(Sortable& s);andtemplate void sort(Sortable& s);The second is more confusing! Why? Because it abuses an already established syntax for something completely different.Is the first confusing? Might be. What is the solution?Solution 1:If this is your code, and you might be confused - don't use it, use the more verbose, but more clear syntax!Solution 2:Just ctrl-click on Sortable (hell, just hover over it) and all you doubts will be solved!Inventing completely new syntax in the form of Sortable{} is even worse:ConsiderNumber x{};[](Number{} x){}[x = Number{}](){}Again, any gains are dwarfed by introducing new syntax to learn and/or new ways to read old constructs!And the biggest problem is - that syntax right now donates an action and here it will not, it will be just an indicator!--- Let's continue furtherAnother non-issue is "the problem one cannot differentiate b/w constrained value and a type concept"template<Concept T, Value v> void f() {}Why this is non-issue?First Because templates are inline, usage is visible and Types and Value are used RADICALLY differently.In real word it will always be clear which is which!Second as already mentioned in one of the papers - one can use a naming convection.Third the more verbose syntax (the a requires clause) is still available!And BTW lets not forget we have class template arguments now, so the template arguments are bound to be a bit overloaded now!template<Concept T, Value v, Class c> void f() {}Nothing wrong with that - we can use naming conventions and we have good IDEs to help us - no need for syntax noise.The Solution To All ThisFor now, include only the syntax clear to a time traveler! Do not include ANYTHING new to learn!We are JUST introducing Concepts to the general public - that alone is enough new material!For Simple casestemplate<Sortable S>void sort(S& s);For Complex casestemplate<Iterator Iter1, Iterator Iter2>requires Comparable_though_iterators<Iter1, Iter2>bool equal(Iter1 first, Iter1 last, Iter2){}THATS IT. DONE.Notemplate void sort(Sortable& s);Novoid sort(Sortable{}& s);Notemplate<Arithmetic{N}, Arithmetic {} n> void f(N);Notemplate<auto Arithmetic N> void f();Notemplate<Comparable_through_iterators{Iter1,Iter2}>bool equal(Iter1 first, Iter1 last, Iter2){}And HELL NoComparable_through_iterators{Iter1,Iter2}bool equal(Iter1 first, Iter1 last, Iter2){}Why?A. Because of the time traveler!!!B. Let the users have theirs say IN THE REAL WORD.C. We can ALWAYS add "simpler" syntax later, say in 5 years!Future DirectionsWhy not let arguments be comma separated lists if we care so much about typingtemplate<class In1, In2, Out>
requires Mergeable<In1, In2, Out>Out merge(In1,In1,In2,In2,Out);
Why not instead of the new syntax for names introducing we simply
it MUST be decupled from Concepts (physically and mentally)it MUST be tackled AFTER Concepts andit MUST handle unconstrained as well.
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5083fdc0-5316-4b70-bb80-c0bc4c756232%40isocpp.org.
I make no defense of the OP's argument, but he is not talking stating that we shouldn't have concepts at all (and thus must continue to use `std::enable_if` gymnastics). He's talking specifically and only about terse syntax for declaring conceptualized template functions.He's saying that we're better off using explicit `requires` clauses than having shorter syntax. He's not saying that we're better off with `enable_if`".