Hi Shawn, first of all I should note that I suspect that you have been under some stress, and you're taking it on me. It's quite unlike you. Is this indeed the case?
Now I'll reply to what you say. On Tuesday 13 Apr 2010 16:07:26 Shawn H Corey wrote: > Shlomi Fish wrote: > > Which arguments do you give in favour of using << shift(@_); >> instead > > of << shift; >>? The fact that << shift; >> extracts out of @_ or @ARGV > > by default is documented in "perldoc -f shift;" > > http://perldoc.perl.org/functions/shift.html and, like I noted, the > > programmer knows which is the case by reading the code and by the > > indentation. > > Things that behave differently should look different. > Well, in Perl and in other languages a lot of code requires the context to understand. For example in C << call_me(one, two, three); >> can be a function call or a C macro call. The distinction between them can be much more critical than a the use of shift; for either @_; or @ARGV. Furthermore, suppose someone tells you an English text they read contains the word "monger". What does it mean? It could mean: 1. Perl/Python/etc. monger - an enthusiast. 2. A fish monger - a seller. 3. A hate monger - someone who spreads something. 4. Other meanings. In Hebrew we use different words for these three cases, and yet it doesn't invalidate the fact that the English word "monger" serves a good purpose. Furthermore, "my $var = shift;" has a very specific common meaning that justifies use of it in both cases - it extracts something out of the array of arguments/parameters - whether command line or in the more common context of a subroutine. If someone shows me the complete code and it's at least moderately well organised, there's very little chance I can mistake it for that. So doing "my $param = sh...@_;" would just be clutter. > Programming is as much about organization and communication > as it is about coding. Why do you think that "my $param = shift;" instead of "my $param = sh...@_;" would undermine a Perl programmer's organisation and communication when writing it? Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Funny Anti-Terrorism Story - http://shlom.in/enemy 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/
