develooper Front page | perl.perl5.porters | Postings from April 2000

Re: [ID 20000403.009] uninitialised concatenation???

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
April 4, 2000 06:47
Subject:
Re: [ID 20000403.009] uninitialised concatenation???
Message ID:
7511.954856020@chthon
The opcodes that Perl compiles your program into ARE NOT THE ONES
THAT YOU SAW.

There are a million cases of this.   Here are two:

    % perl -MO=Deparse -e 'for($i=0; $i<10; $i++){}'
    $i = 0;
    while ($i < 10) {
	();
    }
    continue {
	++$i
    }

Look, there's NO for loop there anymore!  My goodness, what a
terrible bug!   What are you going to do now, change that too?
Also, the postinc you wrote is NOT what Perl is going to execute.
It's a different opcode.  There are *plenty* of other cases like
this.  It's what the compiler is doing.  Here's another:

    % perl -MO=Deparse -ne '$seen{$_}++ && print'
    LINE: while (defined($_ = <ARGV>)) {
	print $_ if $seen{$_}++;
    }

I NEVER SAID if.  But look at that!  And where did that LINE label
come from?  I never said that either.  Dang it, perl is broken.
What do you propose to do about these terrible errors, huh?

--tom

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