C++17 is feature complete

luminousone via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 27 08:43:03 PDT 2016


On Monday, 27 June 2016 at 15:16:19 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 27 June 2016 at 14:57:10 UTC, Patrick Schluter wrote:
>> I forgot. No it's not more readable, to the contrary. The 
>> issue is that normally { } introduces an indentation, which is 
>> always associated with some kind of branching. Adding an 
>> indentation just for the declaration of a variable is an 
>> inconsistency annoying to read. I had the case several times 
>> in the code I was transforming and it had me each time puzzled 
>> at where the loop or condition was.
>
> I see your point, but I like to keep conditional clean. Usually 
> the expression is long when  I have to check an error code in 
> C++. I don't think the following is easy on my eyes and it is 
> not at all clear where the destructor is called:
>
> if ( auto file = 
> ::tool::filesystem::open("/path/to/somewhere/xx"); file != 
> nullptr) {
>    ...
> }  else if(…) {
>     ...
> } else {
>     ...
> }
>
> I think this is easier to read, and the location for the 
> destruction is obvious:
>
> {
>     auto file = 
> ::tool::filesystem::open("/path/to/somewhere/xx");
>
>     if ( file != nullptr ) {
>        ...
>     }  else if(…) {
>        ...
>     } else {
>        ...
>     }
> }
>
> In modern C++ one has to think about introducing scopes to gain 
> control over where RAII is created and destructed.

Modern C++ is a train-wreck, I don't think we should consider D 
features around the flaws of another language.

Luckily we don't have to code with the worry of labyrinth like 
namespaces so deep and bloated that the language needs a special 
keyword to let the compiler know that the following blobby mass 
is a typename.


More information about the Digitalmars-d mailing list