$_ readonly in map/grep (was: Re: summary)
[email protected] (Bart Lateur) Sun, 06 Aug 2000 14:12:27 +0200
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Organization | MediaMind |
| Message-ID | <[email protected]> |
On Fri, 4 Aug 2000 22:21:04 -1000 (HST), Tim Jenness wrote: > Elements of @_ should be read-only (John Tobey) Eck. How about this one: $_ should be read-only inside map/grep (or: $_ would be a copy of the value, not an alias) That would promote the functional programming style in map/grep, i.e. prevent people from using map/grep in a void context, simply in order to replace a for/foreach loop. I know, it's not full-proof. You'd have to make ALL variables inside the block block scoped. But it could also help by accidently modifying the source list items, i.e. modify only a copy. -- Bart.