Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: How to introduce a frustrating bug with a single whitespace

by radiantmatrix (Parson)
on Dec 24, 2007 at 21:06 UTC ( [id://658928]=note: print w/replies, xml ) Need Help??


in reply to Re: How to introduce a frustrating bug with a single whitespace
in thread How to introduce a frustrating bug with a single whitespace

Yes, but at least that gets caught with warnings (or -w):

$ perl -we 'print (4+5)*20;' print (...) interpreted as function at -e line 1. Useless use of multiplication (*) in void context at -e line 1.

The whitespace bug described in the original node is the first bug I've had in a while that:

  • wasn't caught by syntax checking (it's valid Perl)
  • wasn't griped about with strict and warnings on
  • wasn't a design error
<radiant.matrix>
Ramblings and references
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet

Replies are listed 'Best First'.
Re^3: How to introduce a frustrating bug with a single whitespace
by TimToady (Parson) on Dec 24, 2007 at 22:05 UTC
    Well, it's kind of you to say that, but given the fact that Perl 6 changed =~ to ~~, it arguably was a design error. (Though this particular failure mode is not why it was changed, but rather the failure of reversing the operator to say ~= instead. It doesn't matter if you reverse ~~.) Anyway, if you split ~~ in Perl 6 with whitespace, it'll parse, but will likely give you a "useless use of ~ in void context" warning.

    By the way, Perl 6 also fixes the "print (4+5)*20" faq...

complex data structure typo (was Re^3: How to introduce a frustrating bug with a single whitespace)
by doom (Deacon) on Dec 31, 2007 at 02:30 UTC

    The whitespace bug described in the original node is the first bug I've had in a while that:
    • wasn't caught by syntax checking (it's valid Perl)
    • wasn't griped about with strict and warnings on
    • wasn't a design error

    I've got one of those, though not a whitespace bug. Just recently I was messing with a data-structure that was supposed to be an array of arrays of arrays:

    $rect_list = [ [ [0, 0], [3, 9 ] ], [ [5, 4], [3, 10] ], [ [7, 8], [9, 11] ]. [ [2, 4], [5, 15] ], [ [1, 9], [9, 13] ], ];

    First question: Can you spot the bug? Second question: Do you know what it does?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://658928]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 09:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found