C++ Logo

std-proposals

Advanced search

Re: Making C++ easier for new students

From: Bill Kerney <bkerney_at_[hidden]>
Date: Thu, 5 Aug 2021 00:51:06 +0000
Rust issues aside, there's two emails I would like to respond to.

>In my personal opinion C++ will never get good in this areas. Reason is that C++ standardization has very limited resources and they are mostly spent on making language better for professional developers. For example there was proposal for sane main() arguments, that never made it into the standard.

That's more or less what I'm talking about here. I think the recent revisions have been focused on professionals. But a language's long term growth depends on new people being trained in it to replace the old programmers who are retiring.

I'm not so pessimistic about C++ that I think we should just abandon ship for Rust or Python or whatever. There's some low-hanging fruit that would make life a lot easier for people and make people like C++ more when they learn it.

>Some of these things are not language questions but operating system questions.

Well, specifically I'm talking about the C++ standard library, which sits above OS syscalls exactly in order to make them safer and easier to use. As Bjarne put it a couple years back at CppCon, a standard library should make common tasks easy. Handling input is a very common task, and the current implementation in std only makes it easy to do it wrong.

I think it would be nice for input to just, you know, work. Is there any real objection to doing input like this?

int x = read();

>In your particular case unfortunately most beginner programs are read/write to terminal, but I think I have ever seen a program like that made in any company where I worked for.

I have seen fstreams used in commercial settings. Not for high-speed I/O, but for just reading or writing a file, sure. Since people learn how to use fstreams by using iostreams first, they make the same mistakes with fstreams as they do with iostreams, leading to cascading faults and brittle input.

With Readlib, you can also learn on console applications and switch into reading and writing files with just one change:

int x = read(ins);

Thanks,
Bill Kerney

Received on 2021-08-04 19:51:14