in reply to Re: Burned by precedence rules
in thread Burned by precedence rules
Many would find that better expressed as:
sub done { my $self = shift; return 1 unless $self->foo or $self->bar; return; }
because it avoids the two negations which confuse the meaning of the and.
I used to avoid using unless, partly because none of the other languages I've used have had such a thing, but where it drops out a layer of negation I find it helps clean up intent quite nicely.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Burned by precedence rules
by tilly (Archbishop) on Dec 26, 2008 at 05:00 UTC | |
by GrandFather (Saint) on Dec 26, 2008 at 20:45 UTC | |
by tilly (Archbishop) on Dec 27, 2008 at 05:59 UTC | |
by gwadej (Chaplain) on Dec 26, 2008 at 13:25 UTC | |
by tye (Sage) on Dec 27, 2008 at 06:53 UTC | |
by gwadej (Chaplain) on Dec 28, 2008 at 20:53 UTC | |
by tilly (Archbishop) on Dec 26, 2008 at 15:20 UTC | |
by gwadej (Chaplain) on Dec 26, 2008 at 15:39 UTC | |
|
Re^3: Burned by precedence rules
by Marshall (Canon) on Dec 26, 2008 at 18:45 UTC |