sort SUBNAME LIST is sick

polettix on 2008-01-11T10:59:22

I was bite by this:

#!/usr/bin/env perl
use strict;
use warnings;

my @stuff = sort returns_list('whatever'); print "stuff: [@stuff]\n";

@stuff = returns_list('again'); @stuff = sort @stuff; print "stuff: [@stuff]\n";

sub returns_list { return qw( howdy all of you ); }

__END__

poletti@PolettiX:tmp$ /opt/perl-5.8.8/bin/perl bug.pl stuff: [whatever] stuff: [all howdy of you] poletti@PolettiX:tmp$ /opt/perl-5.10.0/bin/perl bug.pl stuff: [whatever] stuff: [all howdy of you]


which is regarded as (thanks dakkar):

$ perl -MO=Deparse sort_bug.pl 
use warnings;
use strict 'refs';
my(@stuff) = (sort returns_list 'whatever');
print "stuff: [@stuff]\n";
@stuff = returns_list('again');
@stuff = sort  @stuff;
print "stuff: [@stuff]\n";
sub returns_list {
    use warnings;
    use strict 'refs';
    return 'howdy', 'all', 'of', 'you';
}


dakkar also reminded me that this was the only way to support what then became sort BLOCK LIST.

This is just sick.


It really is

Aristotle on 2008-01-11T13:16:28

I have complained about that before.