On Fri, Oct 22, 2004 at 01:59:13AM -0700, Yitzchak Scott-Thoennes wrote:
> On Mon, Oct 18, 2004 at 01:05:06PM -0400, Michael G Schwern <[EMAIL PROTECTED]> 
> wrote:
> > On Mon, Oct 18, 2004 at 04:43:12PM +0200, H.Merijn Brand wrote:
> > > > Please consider 0.50 very soon, in which you fix 'err' calls that are an
> > > > obvious mistake given defined-or functionality in blead and 5.8.x-dor:
> > > 
> > > That would be too easy to call. here's a patch ...
> > 
> > Thank you.  Patch provisionally rejected.  Here's why.
> > 
> > By adding a new keyword dor has broken backwards compatibility.  Test::More
> > is doing nothing wrong by current standards.  main::err() is fully declared
> > before its use.  There is no ambiguity.
> > 
> > Now with dor its suddenly a keyword and code breaks at no fault to the 
> > programmer.  Its not just a warning, its a syntax error.  Upgrading from 5.8
> > to 5.10 will break code.  This is a problem.  Its a problem every time we
> > add a new keyword.
> 
> FWIW, "err" is a second-class keyword.  This means that an imported function
> ( or even *err = sub { ... } ) will take precedence over the keyword.
> 
> Does anyone know the history of other keywords that have been added?  Seems
> like there haven't been any in a long while except for "lock", which *was*
> done in a backward-compatible the way M. Schwern suggests for err, but IIRC
> not in an extensible way that could easily be applied to other new keywords.


Comparing the keywords.h file for the major releases (5.000, 5.001, 5.002,
5.003, 5.004, 5.005, 5.6.0, 5.8.0, and 5.9.1) gives the following history:

    No new keywords in perl-5.001
    New in perl-5.002: tied __DATA__ sysopen prototype
    No new keywords in perl-5.003
    New in perl-5.004: __PACKAGE__ sysseek
    New in perl-5.005: qr lock INIT
    New in perl-5.6.0: CHECK our
    No new keywords in perl-5.8.0
       Deleted keywords: LE NE GE EQ GT LT
    New in perl-5.9.1: err


While I won't deny 'err' may be used in many existing programs, I doubt
it's used more than 'lock' was before 'lock' was introduced as a keyword.



Abigail




#!/usr/bin/perl

use strict;
use warnings;
no warnings qw /syntax/;

my @versions = qw /5.000 5.001 5.002 5.003 5.004 5.005 5.6.0 5.8.0 5.9.1/;
my $dir      = "/home/abigail/Src/perl";

my %keywords;
foreach my $version (@versions) {
    my $file = "$dir-$version/keywords.h";
    open my $fh => $file or die "open $file: $!\n";
    while (<$fh>) {
        /KEY_(\w+)/ or next;
        $keywords {$version} {$1} = 1;
    }
}

for (my $i = 1; $i < @versions; $i ++) {
    my %tmp = %{$keywords {$versions [$i]}};
    delete $tmp {$_} for keys %{$keywords {$versions [$i - 1]}};
    if (keys %tmp) {
        print "New in perl-", $versions [$i], ": @{[keys %tmp]}\n";
    }
    else {
        print "No new keywords in perl-", $versions [$i], "\n";
    }
    %tmp = %{$keywords {$versions [$i - 1]}};
    delete $tmp {$_} for keys %{$keywords {$versions [$i]}};
    if (keys %tmp) {
        print "   Deleted keywords: @{[keys %tmp]}\n";
    }
}

__END__

Reply via email to