On Tue, 22 Jun 2004, Juerd wrote: > > rename -v => 1, $orig, $new; [snip] > I think just using named arguments would be better and much easier. > > sub rename ($old, $new, +$verbose) { > say "Renaming '$old' to '$new'" if $verbose;
On Tue, 22 Jun 2004, Brent 'Dax' Royal-Gordon wrote: > It's already being done: > > rename $orig, $new :verbose; > > sub rename($orig, $new, +$verbose) { > say "Renaming `$orig' to `$new'" if $verbose; On Tue, 22 Jun 2004, Luke Palmer wrote: > No, builtins can and will have named arguments. And you can even add > your own to builtin functions: Well, much of what has been said here seems to be quite a bit above my head as far as my Perl6 knowledge is concerned. However I'd like to provide some context for my proposal: one motivation is to give yet more WTDI, and another one is to give a quick'n'easy WTD certain things. AIUI the first point is already addressed as explained in your mails above. As for the second one, the key concept is that of "suitable defaults". For example, using Perl5 syntax, here's what I mean: perl -le 'unlink and print "removing $_" or warn "something: $!\n" for <*.txt>' Well, it would be nice if that may just be perl -e 'unlink <*.txt> :v' And here of course I do *not* want to roll my own version of unlink to manage the verbose info, otherwise it wouldn't be easier than in the first attempt above. Even if put in a package, it would imply more typing: perl -MVerbose -e 'unlink <*.txt> :v' ^^^^^^^ or even more letters!! Of course you may ask why not using rm -v *.txt from start instead, but then there are indeed situations in which perl is actually useful. For example one I can think of (and done in practice) is this: perl -lne 'rename $_, do{($t=$_)=~s/.../.../; $t}' files.txt ^^^^^^^^^^ fake! [no strictures for one-liners!] Well, IMHO it would be a Good Thing(TM) to have a few letters long (or a one letter long) switch to print verbose info... of course it would be most useful in one-liners but as many other things it would come handy also in more complex scripts... Michele -- Se non te ne frega nulla e lo consideri un motore usa e getta, vai pure di avviatore, ma e' un vero delitto. Un po' come vedere un cavallo che sodomizza un criceto!!! - Cesare/"edizioni modellismo sas" su it.hobby.modellismo