On Wed, Mar 25, 2009 at 6:20 PM, Leon Timmermans <[email protected]> wrote:
> I would propose there to be one difference between for an map: map
> should bind its arguments read-only, for should bind them read-write.
> That would make at least one bad practice an error.
Why is r/w map a bad practice if r/w for is not?
Do you look at Perl's "map" and think "A-ha! The map operation is a
functional programming idiom, therefore it must be side-effect free!"?
Because that view doesn't feel terribly Perlish to me.
While I mostly use both map and for in readonly mode, I've been known
to use map for quickie in place mutations, and not necessarily in void
context:
my @prev = map { $_++ } @values;
I'm not arguing for the binding to default to rw - you can always use
"is rw" when needed. I just don't see any reason why the default
binding behavior of map and for should be different.
--
Mark J. Reed <[email protected]>