develooper Front page | perl.perl5.porters | Postings from July 2021

Re: Elevator pitch, deprecating $a/$b sort globals by using sub{}

Thread Previous | Thread Next
From:
=?UTF-8?Q?John_Ankarstr=c3=b6m?=
Date:
July 4, 2021 17:09
Subject:
Re: Elevator pitch, deprecating $a/$b sort globals by using sub{}
Message ID:
sbspvf$tup$1@ciao.gmane.io
Den 2021-07-04 kl. 17:40 skrev Martijn Lievaart:
> Karl Wiliamson's remarks about $a/$b as a quirk got me thinking. With 
> signatures as a language feature it's feasable to make sort not only 
> take a blok or a subroutine name, but also a sub. That means $a and $b 
> for sort can be deprecated in the long run, and eventually turned off 
> with a feature flag if we so choose.

This is a difficult question.  I think that Perl is used in two ways:

   1. For building small scripts.
   2. For building large programs.

This duality means that the design of the language has to be carefully
balanced.  "Small" Perl favors implicitness, "big" Perl favors
strictness.  In some cases, they're mutually incompatible, and it is
important that neither concern be favored to the detriment of the other,
lest an important significant part of Perl users become disillusioned.

In the past, the strict variant of Perl has been the answer to this
divide.  Keeping in mind desires among users of "big" Perl for more
strictness, I think one of the following solutions should be considered:

   1. Implicit $a/$b should be disabled when 'use strict' is active.
   2. Implicit $a/$b should be disabled by a new pragma, 'use stricter'
      = 'use strict' plus any number of further strictures.

The drawback of (2) is that it divides the Perl language even further,
but the benefit is that much more strictness, such as that suggested
here, could be added to Perl without any controversy.  It would satisfy
"big" Perl while not upsetting "small" Perl.

(My personal opinion is that implicit $a/$b is too useful to remove from
strict Perl.)


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