------------------------------------------------ On Fri, 10 Oct 2003 12:53:48 -0700 (PDT), Jeff Westman <[EMAIL PROTECTED]> wrote:
> Wiggins d'Anconia <[EMAIL PROTECTED]> wrote: > > > > ------------------------------------------------ > > On Fri, 10 Oct 2003 09:11:28 -0700 (PDT), Jeff Westman <[EMAIL PROTECTED]> > > wrote: > > > > > > > > > > I know perl returns the last value (statement?) by default, but doesn't > > it > > > make it more readable (or self-documenting) to the next person who may > > come > > > along what my intent is? > > > > > > > Just so your opinion is backed up, I am very glad you said that and > > definitely appreciate it :-). But I am one of those "lets be explicit about > > what I mean" programmers, at least in any thing over 10 lines of code, but > > then I type faster than average which may be why I was never concerned > > about a few extra characters here and there, and I have never had to work > > over a 900, 1200, 2400, baud modem.... > > > > To put it another way, IMHO, you will *never* be frowned upon for including > > a 'return' when that is what you mean, but be prepared for a thrashing the > > first time you leave an open ended function that returns a value that it > > shouldn't and you break someone else's code because of it. > > Hi Wags, > > Not sure what you mean by 'open ended function'. Seems to me there would be > more danger for someone to accidently add code below my last line in my > function. Put another way, using a 'return' statement is explicit, whereas > leaving it as the so-called perl way, leaves it implicit and open to someone > adding their own code below that -- which would then blow up the expected > returned value. > > I'm all for making things consise and effecient, but intent and clarity are > equally important :) Maybe you misunderstood me, or I was unclear (see happens in e-mails too ;-)) but I was actually very much agreeing with you! You have pointed out exactly what I mean by an 'open ended function'... With the 'return' in there the exact situation you mention is, to me, less likely to happen because as you indicate someone will have to pay attention to your previous 'return'. Without the explicit 'close' (read: return) the function is 'open ended' such that code can come after it to form a 'new end'. Always fun when 'diagreeing to agree' ;-)... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
