develooper Front page | perl.perl5.porters | Postings from March 2023

Re: Proposal: Standardize to one space after full stops indocumentation, pod, comments, etc.

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
March 18, 2023 01:02
Subject:
Re: Proposal: Standardize to one space after full stops indocumentation, pod, comments, etc.
Message ID:
6ae8c6c5-0bfe-43f9-8793-141e61386428@dogfoodapp.fastmail.com
On Fri, Mar 17, 2023, at 13:57, Karl Williamson wrote:
> But more importantly, I would lose respect for a project that sought to 
> dictate what's basically an aesthetic issue that has no bearing on the 
> correct functioning of our product.  Timtoady abandoned.

So, first I want to say why I disagree with Karl, but then I'm going to agree with him in the end.  Just so you're prepared.

Here are three presentations of some code.  First, as stored in the repository:
if (name)
    Perl_sv_catpv(aTHX_ report, name);
else if (isGRAPH(rv))
{
    Perl_sv_catpvf(aTHX_ report, "'%c'", (char)rv);
    if ((char)rv == 'p')
        sv_catpvs(report, " (pending identifier)");
}
else if (!rv)
    sv_catpvs(report, "EOF");
else
    Perl_sv_catpvf(aTHX_ report, "?? %" IVdf, (IV)rv);
switch (type) {
case TOKENTYPE_NONE:
    break;
case TOKENTYPE_IVAL:
    Perl_sv_catpvf(aTHX_ report, "(ival=%" IVdf ")", (IV)lvalp->ival);
    break;

Then, as I would format it:
if (name) {
  Perl_sv_catpv(aTHX_ report, name);
} else if (isGRAPH(rv)) {
  Perl_sv_catpvf(aTHX_ report, "'%c'", (char)rv);
  if ((char)rv == 'p') sv_catpvs(report, " (pending identifier)");
} else if (!rv) {
  sv_catpvs(report, "EOF");
} else {
  Perl_sv_catpvf(aTHX_ report, "?? %" IVdf, (IV)rv);
}

switch (type) {
  case TOKENTYPE_NONE:
    break;
  case TOKENTYPE_IVAL:
    Perl_sv_catpvf(aTHX_ report, "(ival=%" IVdf ")", (IV)lvalp->ival);
    break;

Then, whimsically:
if (name)                         Perl_sv_catpv(aTHX_ report, name);
else if (isGRAPH(rv))           {
                                  Perl_sv_catpvf(aTHX_ report, "'%c'", (char)rv);
                                  if ((char)rv == 'p')
                                  sv_catpvs(report, " (pending identifier)");
                                }
else if (!rv)                     sv_catpvs(report, "EOF");
else                              Perl_sv_catpvf(aTHX_ report, "?? %" IVdf, (IV)rv);

/**/

switch (type) {
  case TOKENTYPE_NONE:    break;
  case TOKENTYPE_IVAL:    Perl_sv_catpvf(aTHX_ report, "(ival=%" IVdf ")", (IV)lvalp->ival);
                          break;

These (modulo any accidental error I introduced) are aesthetic issue that has no bearing on the correct functioning of our product.  But we don't want to continually mix them all throughout the source code, these and many other style intertwined and shifting around as code is rewritten.

The product will function either way, but one gets in the way of just dropping into any part of the code and reading it for content. The varied form obscures the (unchanged) function from the would-be editor.  So I strongly believe that it is a good idea for a software project to enforce aesthetic choices for the good of the project.  In a language that's more amenable to static analysis, I'd also say that automatic enforcement of style is not necessarily an evil.

That said… one of two spaces after a full stop does not strike me as something the casual editor will notice.  It is not something whose variance between parts of the code is going to cause strife.  This sounds like forcing an aesthetic choice for the sake of some automated bit of tooling, at cost to humans.  So, the cost to humans who are now hitting "space space backspace" every sentence has to buy something pretty valuable.  *What is that?*

Yves said that the primary problem was that "it is relatively difficult to write software that can identify a full stop as a full stop and do the right thing".  So, what software is it that we need to run against our comments, and which has to be so unerring that we want to change how people write prose?

-- 
rjbs
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About