Hi Shawn,
On Friday 26 Mar 2010 18:39:30 Shawn H Corey wrote:
> On Fri, 26 Mar 2010 16:06:04 +0300
>
> Shlomi Fish <[email protected]> wrote:
> > One thing hackers like is brevity.
>
> I got a better idea. Let's assume that the person who maintains your
> code is a recent graduate that doesn't have any experience with Perl.
> How would he know that shift does two different things?
>
By learning Perl. This use of shift; is documented and is used in production
on CPAN and in many other places. It takes exactly a minute to explain the
difference to a competent programmer (and if they aren't competent, you're
screwed).
> It's nice to be brief but only providing it does interfere with
> understanding. Remember: Hard to understand code is costly to
> maintain code.
I don't believe in programming in an idiot-proof manner and avoiding useful
features in order to dumb down the code. Using "my $param = shift;" is not
harder to understand than "my $param = shift(@_);" and it clutters the code
less, and everyone who knows a minimal amount of Perl will likely learn about
it. We shouldn't avoid using powerful features and DWIMeries (Do-What-I-Mean)
just because people will need to be aware of them.
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Stop Using MSIE - http://www.shlomifish.org/no-ie/
Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/