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

toke.c attribute weirdness

Thread Next
Simon Cozens
July 8, 2001 03:18
toke.c attribute weirdness
Message ID:
While diving through toke.c, the perfect Sunday morning activity, I found
the above code related to attributes:
    if (isLOWER(*s) && (tmp = keyword(PL_tokenbuf, len))) {
        if (tmp < 0) tmp = -tmp;
        switch (tmp) {
        case KEY_or:
        case KEY_and:
        case KEY_for:
        case KEY_unless:
        case KEY_if:
        case KEY_while:
        case KEY_until:
            goto got_attrs;

Why? This means we have:

 % perl -le 'my $foo :next;' 
Invalid SCALAR attribute: next at -e line 1
BEGIN failed--compilation aborted at -e line 1.

 % perl -le 'my $foo :for;' 
syntax error at -e line 1, near "for;"
Execution of -e aborted due to compilation errors.

I can't see any logical reason for this.

"Though a program be but three lines long,
someday it will have to be maintained."
-- The Tao of Programming

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About