Re: perl style: can I combine two steps into one?
From: John Bokma (postmaster_at_castleamber.com)
Date: 02/06/05
- Next message: YYusenet: "Re: Perl - permute?"
- Previous message: John Bokma: "Re: Why aren't 'warnings' on by default?"
- In reply to: RedGrittyBrick: "Re: perl style: can I combine two steps into one?"
- Next in thread: Abigail: "Re: perl style: can I combine two steps into one?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 6 Feb 2005 19:34:50 GMT
RedGrittyBrick wrote:
> John Bokma wrote:
[ snip ]
> Since I was raised on FORTRAN, it is deeply ingrained in me that one
> should never test floating point numbers for equality. So I tend to feel
> more comfortable writing "x >= 10" than "x = 10" where x is being
> incremented in some fashion.
It wasn't a float.
> Unfortunately this aversion also applies
> inappropriately to integer comparisons.
>
> Perhaps one should write
> last if i == 10;
> die "Too many impossible things before breakfast." if i > 10;
As silly as:
die "Panic" if int( i ) != i;
if i is already int.
If i "suddenly" becomes float, it's quite weird to rely on the fact that
you already took care of i possible becoming float.
-- John Small Perl scripts: http://johnbokma.com/perl/ Perl programmer available: http://castleamber.com/ Happy Customers: http://castleamber.com/testimonials.html
- Next message: YYusenet: "Re: Perl - permute?"
- Previous message: John Bokma: "Re: Why aren't 'warnings' on by default?"
- In reply to: RedGrittyBrick: "Re: perl style: can I combine two steps into one?"
- Next in thread: Abigail: "Re: perl style: can I combine two steps into one?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|