From geoffjentry at hexdump.org  Tue Feb 15 22:55:30 2011
From: geoffjentry at hexdump.org (Geoff Jentry)
Date: Tue, 15 Feb 2011 13:55:30 -0800 (PST)
Subject: [Rd] Request: Suggestions for "good teaching" packages,
 esp. with C code
In-Reply-To: <4D5AF4A8.50001@auckland.ac.nz>
References: <AANLkTikODppzk5=x7=TzVepH+aHuvaZUErf_0xQZ5ioX@mail.gmail.com>
	<4D5AF4A8.50001@auckland.ac.nz>
Message-ID: <Pine.LNX.4.64.1102151353000.13921@cardinals.dreamhost.com>

On Wed, 16 Feb 2011, David Scott wrote:
>> 4. We don't want gratuitous use of "return" at the end of functions.
>> Why do people still do that?
> Well I for one (and Jeff as well it seems) think it is good programming 
> practice. It makes explicit what is being returned eliminating the 
> possibility of mistakes and provides clarity for anyone reading the code.

You're unnecessarily adding the overhead of a function call by explicitly 
calling return().

Sure it seems odd for someone coming from the C/C++/Java/etc world, but 
anyone familiar with R should find code that doesn't have an explicit 
return() call to be fully readable & clear.

-J



[Rd] Request: Suggestions for "good teaching" packages, esp. with C code
Geoff Jentry