in reply to (Ovid) RE(2): modify variable on pass by value
in thread modify variable on pass by value
Don't get me wrong. I'm not an FP fascist. But most of the time, temporary values forced on me by the syntax just seems awkward.
Let's go back to this remove-cap function. In a return-value situation, I can use it like this:
Whereas in a act-on-arguments mode, I've got to write this:my @data = map { RemoveCaps $_ } @input;
I can't use $_ directly, because it would attempt to alter @input (see the other thread on that {grin}). So now I have to invent a stand-in, just so I can act on it.my @data = map { my $x = $_; RemoveCaps $x; $x } @input;
Just one guy's opinion from someone who's been coding for 30+ years.
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: (Ovid) RE(2): modify variable on pass by value
by cwest (Friar) on Sep 11, 2000 at 20:45 UTC | |
by merlyn (Sage) on Sep 11, 2000 at 20:47 UTC | |
by chromatic (Archbishop) on Sep 11, 2000 at 21:13 UTC | |
|
(Ovid - Synthetic code) R(4): modify variable on pass by value
by Ovid (Cardinal) on Sep 11, 2000 at 22:55 UTC | |
|
RE: RE: (Ovid) RE(2): modify variable on pass by value
by merlyn (Sage) on Sep 12, 2000 at 21:12 UTC |