laziness, impatience, and hubris | |
PerlMonks |
Re: Case-insensitive, dash-optional named parameters for your functionsby iblech (Friar) |
on Nov 08, 2004 at 16:11 UTC ( [id://406096]=note: print w/replies, xml ) | Need Help?? |
By just adding a + in front of the variable name you can (actually have to) pass this parameter named. I noticed, in Perl 5, that you often have only a little small function taking only one parameter:
Later on, you see the need to add a second positional parameter. And maybe your small function won't stop growing and you require a third and fourth parameter, too.
You think, "I should use named paramaters here", but you (read: I) are probably too lazy to rewrite foo to:
Instead, you keep your positional argument calling (bad). But in Perl 6, all you'll have to do is to add one small little +, and (of course) you won't have to extract the parameters out of @_ yourself! And you get compile-time checking, too :)
In Section
Cool Uses for Perl
|
|