--
---
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/.
Oh god, please no!The language should continue to evolve to be less cryptic and more readable. Introducing magic symbols is the opposite of that.
[](auto &&...args) {some_func(std::forward<decltype(args)>(args)...);}
[](auto &&...args) {some_func(>>args...);}
I think we could easily add @ to the character set (but maybe not for this use).
Anyone that complains that they don't have a @ key can just *email* us. :-)
Nicol and Ville write:
> These days, the problem isn't so much that we can't expand the character set. It's that other people have already done so, and we don't want to break their extensions.
> They are not really language extensions, they are stand-alone tools that have no idea how to parse any of C++.
These are good points. The points are conceded.
Nevertheless, my experience teaching C++ to 18- and 19-year-old engineering beginners is that they are not getting the point of const until six months after they should. This tells me that the language (C++) and the instructor (me) are letting them down. The letdown is not for lack of effort on the language's or instructor's part. The problem seems to be structural.
Seen in hindsight, when first invented, C and especially C++ should probably have defaulted to const, allowing mutability only by explicit specification. For historical reasons, of course, that didn't happen. Today, to you and me, typing const over and over (and over and over and over) is a minor irritation, but it's a pretty big obstacle to C++ programmers with fewer than two years of serious coding experience. They don't even know all the places they can type const. Besides, observe how persistent the often unnecessarily constless traditional definition int main(int argc, char **argv) has remained—even among experienced programmers who should arguably know better. After all, who likes to typeint main(const int argc, const char *const *const argv)
even if that is what he or she really means?
In C++, one can write,const auto a = foo();
However, one would rather write,@auto a = foo();
I wish that @ were a standard abbreviation for const. Reason: frequent repetition of the five-letter keyword const clutters a source file.
MISAPPREHENSION BY BEGINNING STUDENTS OF C++
One reason I ask is that I have instructed engineering students in freshman-level beginning C++ at a U.S. university. That was a few years ago, pre-C++11, but my experience was that the majority of the students failed to grasp the significance of const during their first year.
Even after I had assigned a special-purpose homework exercise to require the student to insert const everywhere possible/reasonable, the majority of the students failed to internalize the lesson. A standardized @ may seem trivial, but I suspect that it would help. The @ looks important. Since it is important, to make it look important might not be a bad thing.
Rust apparently asks the programmer to type mut for "mutable" if constness is not wanted. Isn't that a good idea?
C++ is not a functional programming language.
We have mutable state, and that's not a bad thing.
The sooner programmers accept that, the better.
Nevin summarizes why my @ idea won't work, thanks. Permit me to concede the point.
However, the @ idea was mistargeted at a larger issue.
On Sunday, July 30, 2017 at 7:27:30 PM UTC, Nicol Bolas wrote:C++ is not a functional programming language.
Yes but C++ is a multiparadigm programming language. That's what makes it so great.
You have correctly intuited that I believe that C++ wants improved functional support, but I am a 49-year-old electrical engineer without a C.S. degree, so my position (alas) is an entirely practical position rather than a theoretical or ideological one.
Functional is a paradigm. To the extent to which I have voluntarily chosen the functional paradigm in a certain module of my program, I would like the compiler to competently enforce the paradigm I have chosen.
Competent enforcement of paradigms yields correct code. If I did not want the compiler to enforce a paradigm, then I'd be happy programming in plain C.We have mutable state, and that's not a bad thing.
But often it is a bad thing, isn't it, especially for concurrency.
I would like C++ to provide more convenient, optionally activated, compiler-enforced support to help me consistently to avoid the bad thing. Wouldn't you?
The sooner programmers accept that, the better.
If you were saying that future C++ standards were incapable of gaining first-class support for the functional paradigm, then I would hope that you were mistaken. We already have lambdas, so C++'s trend fortunately is good.
Like you, I have a lot of years invested in C++. Compiler and library developers have even more invested. To see an alternate language like Rust displace C++ would hardly benefit any of us.
Specifcally for @, Objective C++ uses it.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
--
---
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.
On Sunday, July 30, 2017 at 4:48:19 PM UTC-4, Thaddeus H. Black wrote:Functional is a paradigm. To the extent to which I have voluntarily chosen the functional paradigm in a certain module of my program, I would like the compiler to competently enforce the paradigm I have chosen.
You can't.
That is, in fact, the whole point of a multi-paradigm language. The compiler can allow you to live within whichever paradigm you choose.
But in order to allow different people to choose different paradigms, it cannot impose a paradigm upon you.
Multi-paradigm languages allow; they do not enforce.
Do you really think you would rather write:
static char @ * @ array[] = { "abc", "def" };
const std::string refer concat(const std::string refer a, const std::string refer b) { // this is strange
...
}