Re: cmd line like switches for functions and operators.

2004-06-29 Thread Michele Dondi
On Thu, 24 Jun 2004, Luke Palmer wrote: defaults. For example, using Perl5 syntax, here's what I mean: ^^ ^^ [snip] perl -e 'unlink *.txt :v' Well it's certainly not going to be that, since the glob

Re: cmd line like switches for functions and operators.

2004-06-24 Thread Michele Dondi
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

Re: cmd line like switches for functions and operators.

2004-06-24 Thread Larry Wall
On Tue, Jun 22, 2004 at 11:50:03AM -0600, Luke Palmer wrote: : That one doesn't work. Named arguments have to come at the end of the : parameter list (just before the data list, if there is one). This is : a decision I'm gradually beginning to disagree with, because of: : : sub repeat

Re: cmd line like switches for functions and operators.

2004-06-24 Thread Luke Palmer
Michele Dondi writes: 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'

Re: cmd line like switches for functions and operators.

2004-06-23 Thread Juerd
Luke Palmer skribis 2004-06-22 16:32 (-0600): *rename.wrap - $orig, $new, *%opt { say Renaming '$orig' to '$new' if %opt{'verbose' | 'v'}; call; } Would it be possible to just add a named argument, without repeating any part of the existing signature? Like:

cmd line like switches for functions and operators.

2004-06-22 Thread Michele Dondi
I know that it is probably (a few years) too late for a proposal like this, that is highly invasive wrt Perl's semantic, but here it is anyway... Cmd line switches are so useful and effective to quickly change the behaviour of programs: IIRC tcl's syntax was inspired by them. But OTOH it is too

Re: cmd line like switches for functions and operators.

2004-06-22 Thread Juerd
Michele Dondi skribis 2004-06-22 18:24 (+0200): rename -v = 1, $orig, $new; Any specific reason for the minus there? Perl's not a shell (yet). rename.SWITCHES{-v} = sub { my ($o, $n) = @_; print renaming `$o' to `$n'\n; } I think just using named arguments would be better

Re: cmd line like switches for functions and operators.

2004-06-22 Thread Brent 'Dax' Royal-Gordon
Michele Dondi wrote: Specifically I'd like to have the possibility of doing something like this: rename -v = 1, $orig, $new; It's already being done: rename $orig, $new :verbose; sub rename($orig, $new, +$verbose) { say Renaming `$orig' to `$new' if $verbose; ... }

Re: cmd line like switches for functions and operators.

2004-06-22 Thread Luke Palmer
Juerd writes: Michele Dondi skribis 2004-06-22 18:24 (+0200): rename -v = 1, $orig, $new; Any specific reason for the minus there? Perl's not a shell (yet). rename.SWITCHES{-v} = sub { my ($o, $n) = @_; print renaming `$o' to `$n'\n; } I think just using named

Re: cmd line like switches for functions and operators.

2004-06-22 Thread Michele Dondi
On Tue, 22 Jun 2004, Juerd wrote: Michele Dondi skribis 2004-06-22 18:24 (+0200): rename -v = 1, $orig, $new; Any specific reason for the minus there? Perl's not a shell (yet). Because one may want to restrict the number of pairs to be interpreted as cmd line switches, I'm not even sure

Re: cmd line like switches for functions and operators.

2004-06-22 Thread Michele Dondi
On Tue, 22 Jun 2004, Brent 'Dax' Royal-Gordon wrote: rename -v = 1, $orig, $new; It's already being done: rename $orig, $new :verbose; sub rename($orig, $new, +$verbose) { say Renaming `$orig' to `$new' if $verbose; ... } I'm not sure if I

Re: cmd line like switches for functions and operators.

2004-06-22 Thread Luke Palmer
Michele Dondi writes: On Tue, 22 Jun 2004, Brent 'Dax' Royal-Gordon wrote: rename -v = 1, $orig, $new; It's already being done: rename $orig, $new :verbose; sub rename($orig, $new, +$verbose) { say Renaming `$orig' to `$new' if $verbose; ...