From: Jason Vogel Date: 2006-12-10T15:35:04+09:00 Subject: Re: Difference between nil? vs. (variable != nil)... I appreciate the advice. I've just being trying to be careful to not be too C#/Java-ish. I've never done any Perl. Thanks, Jason On Dec 7, 12:55 am, David Vallner wrote: > James Moore wrote: > > Is there a particular reason you're comparing to nil? Normally I'd just > > write something like > > > (@product_coverages && @product_coverages.length > 0)This is Perlish, and there's people (myself included) that don't like > the style - it hides the nil-check, which is useful to be more visible > if you're doing it as a special case filter, like snippet B in the > original post does. I usually prefer getting rid of special cases like > missing arguments etc. with a series of checks and returns / exceptions > in the worse cases at a the beginning of a method to keep precondition > verification in one place instead of scattered through the code with > failure consequences interspersed with regular processing. > > David Vallner > > signature.asc > 1KDownload