C++ Logo


Advanced search

Subject: Re: [std-proposals] Simple Beautification and readability open for template classes
From: Chris Green (aachrisg_at_[hidden])
Date: 2020-10-16 00:49:18

On Thu, Oct 15, 2020 at 9:48 PM Jason McKesson via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Why did you write it that way? One of the few nearly universal
> This was an accidental wordwrap mistake posting from a tablet. Their code
is formatted perfectly in conformance with the broad consensus for this
kind of file.
I apologize for the proofreading as well. I'm playing with a development
environment on a tablet and there's a little clunkiness to it.

Yes, the original file follows the standard convention of having the
template keyword and parameters on the line above the classes name and
options. However, that has the readability issue which is worse in some
ways. Now, every other line is a complex declaration while the other lines
are complex prefixes to declarations. The new identifier you're looking for
is really getting surrounded. And people (wisely) choose to bypass the
logical indentation of the line after the template declaration by keeping
it in column 0 even though it is a continuation.

I don't have any trouble reading any c++ code. This has nothing to do with
saving typing - its about saving neuron activations while _reading_ code.
This is from the perspective of large dynamic codebases and ways to improve
readability across varying skill levels and commitment/time for fancy
documentation (ie the game industry). Admittedly it is minor however it
seems very symmetric with the new template-less template function syntax.
When we already have a general syntax using angle brackets for "parameters
that must be known at compile time, and can include typenames etc", maybe a
the template<> keyword is just noise in some contexts especially now that
we have Concepts. Obviosly there are hard limits in that direction without
introducing ambiguity but I don't think this is one of them.

I think the macro hacks everyone does to get around namespace{ make the
other half of the proposal pretty solid though?


STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups