Re: [svn:perl6-synopsis] r11115 - doc/trunk/design/syn
On Fri, Aug 18, 2006 at 07:53:14PM +0300, Markus Laire wrote: : ps. Then there's the perl5-behaviour of "perl -n0e unlink" where also : the intervening switches can get arguments. This could be expanded so : that all chars for which there's no 1-char alias defined, are : parameters. So C<-aHellobWorld> would mean C<-a=Hello -b=World> if : there are 1-char aliases only for a & b. ;) I think that safely falls into the category of completely psychotic. @L@ Larry
Re: [svn:perl6-synopsis] r11115 - doc/trunk/design/syn
On 8/18/06, Larry Wall <[EMAIL PROTECTED]> wrote: On Fri, Aug 18, 2006 at 12:56:30PM +0300, Markus Laire wrote: : What about combined short switches like C<-abc> to mean C<-a -b -c>? : Will perl6 support this notation or not? Hmm, that opens up a world of hurt. Either you have to distinguish a --abc from -abc, or you have to have some kind of fallback heuristic, and it doesn't work terribly well with arguments in any case except for the final one. Should probably make it possible, just because the external interface is one of the places where Perl has always tried to be accommodating to existing culture rather than revisionist. We can probably work something out here, along the lines of: if there's only one - if single character aliases are defined if the word matches that alphabet if the word doesn't match any longer names At first I was inclined to say that if there's a *% then all the unrecognized go in there and you can parse the -abc yourself, but that doesn't tell you how to treat the next argument unless we look at the definition of -c anyway. We can't just say that -c's arg must use the -c=arg form, since even Perl 5 violates that with -e. :/ Larry Yep, I understand it's not an easy question. Still I was thinking of behaviour where C<-abc> would allways mean C<-a -b -c> regardless of what 1-char aliases or longer names have been defined. This would make --abc and -abc mean completely different things. And in this proposal only the last switch would be able to get an argument, e.g. with C<-abc=99> or C<-abc 99> or something like that. If this can't be the default behaviour, then it would be nice to be able to easily switch to this kind of behaviour. ps. Then there's the perl5-behaviour of "perl -n0e unlink" where also the intervening switches can get arguments. This could be expanded so that all chars for which there's no 1-char alias defined, are parameters. So C<-aHellobWorld> would mean C<-a=Hello -b=World> if there are 1-char aliases only for a & b. ;) -- Markus Laire
Re: [svn:perl6-synopsis] r11115 - doc/trunk/design/syn
On Fri, Aug 18, 2006 at 12:56:30PM +0300, Markus Laire wrote: : What about combined short switches like C<-abc> to mean C<-a -b -c>? : Will perl6 support this notation or not? Hmm, that opens up a world of hurt. Either you have to distinguish a --abc from -abc, or you have to have some kind of fallback heuristic, and it doesn't work terribly well with arguments in any case except for the final one. Should probably make it possible, just because the external interface is one of the places where Perl has always tried to be accommodating to existing culture rather than revisionist. We can probably work something out here, along the lines of: if there's only one - if single character aliases are defined if the word matches that alphabet if the word doesn't match any longer names At first I was inclined to say that if there's a *% then all the unrecognized go in there and you can parse the -abc yourself, but that doesn't tell you how to treat the next argument unless we look at the definition of -c anyway. We can't just say that -c's arg must use the -c=arg form, since even Perl 5 violates that with -e. :/ Larry
Re: [svn:perl6-synopsis] r11115 - doc/trunk/design/syn
On 8/18/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: +To give both a long and a short switch name, you may use the pair +notation. The key will be considered the short switch name, while +the variable name will be considered the long switch name. So if +the previous declaration had been: + +sub MAIN (:f($frompart), :t($topart), [EMAIL PROTECTED]) + +then you could invoke the program with either C<-f> or C<--frompart> +to specify the first parameter. Likewise you could use either C<-t> +or C<--topart> for the second parameter. What about combined short switches like C<-abc> to mean C<-a -b -c>? Will perl6 support this notation or not? -- Markus Laire