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 to

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

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

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 ev

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

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 $verb