in reply to Re^2: Adventures in Debugging a Perl/Tk Game
in thread Adventures in Debugging a Perl/Tk Game
Thanks for the references. I understand Abigail-II's arguments, but I find that I agree with tilly's reply and demerphq's reply to the reply. When I see map in void context, it makes me wonder if the programmer meant something different than what's written. Was that line an assignment before? Was the returned list being used for something? Did the programmer forget something?
Not long ago, I encountered "(my $x, $y) = f()", which is equivalent to "my $x;($x, $y) = f()". As it turned out, that is what the programmer intended, but I spent quite a while finding that out, because at first glance I wondered if it was supposed to be "my ($x, $y) = f()".
(Back to map.) Given that the equivalent code (with for) is just as easy to write, the map stands out. If you're using it to get a list context (as mentioned in Re: Think for yourself.), then I think that would make an excellent comment right above.
(As a semi-side remark, in Re: Think for yourself., Abigail-II says that a familiarity with map (from experience in other languages) that predates Perl's map is some part of the reason for seeing it as just another looping construct. I, too, was using maps in Scheme before I ever saw it in Perl, so I find it interesting that I don't share that view of it.)
Thanks again for the references. It really is fascinating reading, and I recommend it to any other monk reading this.
|
|---|