Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: Perl Lint? Keywords: detab Message-ID: <10751@jpl-devvax.JPL.NASA.GOV> Date: 14 Dec 90 20:01:19 GMT References: <1990Dec3.035541.24184@agora.uucp> <452@stephsf.stephsf.com> <111028@convex.convex.com> <454@stephsf.stephsf.com> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 30 In article <454@stephsf.stephsf.com> wengland@stephsf.stephsf.com (Bill England) writes: : In article <111028@convex.convex.com> tchrist@convex.COM (Tom Christiansen) writes: : : >: return (); : >:} : : >Hmm... shouldn't that last one be: : > : > return ''; # or return undef : > : : Good point ... "perl lint" with return type checking anyone ? Remember that Perl subroutines can be context sensitive. A Perl lint would probably have to punt on any routine containing the wantarray function, or do some rather hairy analysis. And this still wouldn't solve the "problem" that a routine can return () in a scalar context even when the return type is consistent. And it's not always possible to look at a subroutine call and tell easily if it's in a scalar or array context, since it can vary dynamically (if the call is embedded in another subroutine). You'd have to construct the entire call graph. Probably not worth it, given that () in a scalar context Does the Right Thing anyway. It might possibly be worth putting in a warning about, if -w is set and it can determine at runtime that there's an inconsistency. (I can tell I've been writing the Book too long\*-I wanted to write .P \-w instead.) Larry