On Tue, 20 Jan 2009, Paul Vixie wrote:

>> So, to go to another component or URL, I thought "redirect" was basically
>> the only way to do it.  I guess from using other languages, I thought
>> return is used alone (i.e., "return;") or with some status code (i.e.,
>> "return 1;").
>
> like i said it's shorthand since the return value of this function isn't
> used by its caller and it looks better to most of us as a single line even
> though it's somewhat misleading (but that's perl for you).

I disagree. It looks _worse_ as one line, for precisely this confusing 
reason.

I'm a big fan of writing code that shows my intention. If your intention 
is to call a component and then exit the current component with no return 
value, the two-line version is very clear. In the other one, you've saved 
three keystrokes (semi-colon, enter, tab) and added a lot of confusion.

Even worse, you've set up a potential cargo-cult situation down the line, 
where the next programmer comes along and things you _meant_ to return 
said component's return value, and starts doing the same thing elsewhere.


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to