groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [groff] 15/39: [grog]: Drop relic code and comments.


From: G. Branden Robinson
Subject: Re: [groff] 15/39: [grog]: Drop relic code and comments.
Date: Sun, 30 Oct 2022 21:08:06 -0500

Hi Dave!

At 2022-10-30T19:50:38-0500, Dave Kemper wrote:
> > commit 6f2e3678366b33ee35cbedf79198c92e88bae29b
> > Author: G. Branden Robinson <g.branden.robinson@gmail.com>
> > AuthorDate: Mon Oct 24 17:08:35 2022 -0500
> >
> >     [grog]: Drop relic code and comments.
> 
> The comment seems inessential, but I don't believe the two lines of
> code are relics.
> 
> > -require v5.6;
> 
> Pre-5.6 perls are probably rare these days, but if grog does indeed
> require 5.6 features, any users with an older perl ought to be told
> right away rather than face potentially baffling error messages later
> in the execution.

They'll be told at configure time, because we have an Autoconf test for
it.

# We need Perl 5.6.1 or newer.

AC_DEFUN([GROFF_PERL], [
  PERLVERSION=v5.6.1
  AC_PATH_PROG([PERL], [perl], [no])
  if test "$PERL" = no
  then
    AC_MSG_ERROR([perl binary not found], 1)
  fi
  AX_PROG_PERL_VERSION([$PERLVERSION], true,
    AC_MSG_ERROR([perl version is too old], 1))
])

But the main reason I dropped this (perhaps I should have said so) is
that none of our other Perl scripts use it.[1]  I presume that some or
all of them use features introduced as late as 5.6(.1).  (If not, we
could have a more lenient version check.)

Furthermore, I've rewritten grog nearly completely since Bernd last
touched it.  I don't have any idea what Perl 5.6(.1) features Bernd had
in mind when he added that statement.  Moreover, and I'm sorry to say
this, but from what I've seen of Bernd's code, I would not be surprised
to learn that he cargo-culted this line into the script from another one
of his.

Yet another reason is that Perl 5.6.1 is incredibly old (April 2001).  I
cannot find any evidence of any current distribution supporting it.
Consulting

https://repology.org/project/perl/versions

...the oldest Perl version I can locate in this index is 5.8.5.06, from
something called "OS4Depot", of which I have never heard.  The next most
geriatric one is 5.8.8 from "AIX Open Source Packages".  While I've
heard of AIX ("It will remind you of Unix."), the name of this combined
with the Perl version (released February 2006) suggests a
throw-it-over-the-wall capitalization on the once-exciting marketing
buzzword "open source".  I get the feeling such a product was born
end-of-lifed.  Yet even it is modern enough to survive rejection by the
deleted statement.

In other words, I'm willing to accept the risk until we can gather some
concrete knowledge of features our scripts are exercising that
real-world deployments can handle.  At that point it will be completely
appropriate to (1) revise the scripts for greater backward
compatibility; (2) restore an _annotated_ "require" statement
identifying the feature(s) demanded so that the statement is
_maintainable_; or (3) ratchet up the minimum Perl version required by
our build.

> > -$\ = "\n";
> 
> $\ is undefined by default, so the effect of this line's removal is
> immediately apparent by running "grog --version" on the new code,
> which no longer emits the trailing newline after the version
> statement.

Whoops!  You're right.  I'll fix that.  I chopped the '$\' assignment
out because I couldn't get the (recently revised) usage message to
format as I wanted otherwise.

> Some grog "print"s, but not all, do include an explicit "\n" at the
> end of the output string, but you'd have to check the entire program
> for consistency in this.  The simpler solution, at least in the
> interim, is to restore the line above defining the output record
> separator, guaranteeing that the "\n" is output.

I'd prefer to audit the script as you describe than to restore this
arcane feature to it; I had to find out about it the hard way.

So I'll give every print statement in the script a look.

I gather that Perl 5.10 introduced the "say" built-in function for
yammering to streams with implicit trailing newlines.

Thanks for reviewing my commits!

Regards,
Branden

[1] Except "chem", which is (1) in contrib/ and (2) in sore need of many
    heavy blows from the refactoring hammer.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]