Re: r24846 - docs/Perl6/Spec
* jerry gay jerry@gmail.com [2009-01-09 22:45]: it's eager for the match to close Impatient, hasty? Regards, -- Aristotle Pagaltzis // http://plasmasturm.org/
Re: r24846 - docs/Perl6/Spec
On Fri, Jan 9, 2009 at 7:34 PM, jerry gay jerry@gmail.com wrote: If that's now the case, that's unfortunately confusing. In other contexts, eagerness is leftmost (eager for matching to start, if you like), which is orthogonal to greed: Indeed, in the context of regular expressions this definition is well-established, used in Friedl's book (widely considered definitive) among other places. i agree the wording isn't clear here, but it is consistent with the current design language. Consistent how? In that eager isn't used anywhere else yet, or is this use of eager already established in the spec? i don't want to define something with a negative, so i purposefully did not use non-greedy. Well, you're not defining. You're contrasting with an established definition. If you have what is essentially a Boolean-valued attribute of behavior, surely it makes sense to use positive and negative versions of a single adjective rather than two distinct ones - especially two which aren't even antonyms in English. If you must use a non-derived(*) form, why not choose something that means non-greedy in English? Maybe generous? (*) Note casual use of non- in actual dialogue :) -- Mark J. Reed markjr...@gmail.com
r24846 - docs/Perl6/Spec
Author: particle Date: 2009-01-09 22:05:46 +0100 (Fri, 09 Jan 2009) New Revision: 24846 Modified: docs/Perl6/Spec/S19-commandline.pod Log: [S19] describe how to avoid ambiguity when nesting delimited options Modified: docs/Perl6/Spec/S19-commandline.pod === --- docs/Perl6/Spec/S19-commandline.pod 2009-01-09 21:03:17 UTC (rev 24845) +++ docs/Perl6/Spec/S19-commandline.pod 2009-01-09 21:05:46 UTC (rev 24846) @@ -276,10 +276,8 @@ The opening and closing delimiters begin with two or more plus characters, for example C++. You'll usually use two plus characters, but more are -allowed to avoid ambiguity. +allowed to avoid ambiguity when nesting delimited options. -{{TODO put more below, or refer to somewhere with more}} - =item * Opening and closing delimited option names follow option identifier naming @@ -311,9 +309,26 @@ ++PARSER --prelude=Perl6-autoloop-no-print ++/PARSER is available inside your script as C %+OPTSPARSER , and contains -C--prelude=Perl6-autoloop-no-print. +C--prelude=Perl6-autoloop-no-print. Since eager matching is used, if you +need to pass something like: + ++foo -bar ++foo baz ++/foo ++/foo +you'll end up with + + %+OPTSfoo = '-bar ++foo baz'; + +which is probably not what you wanted. Instead, add extra C+ characters + + +++foo -bar ++foo baz ++/foo +++/foo + +which will give you + + %+OPTSfoo = '-bar ++foo baz ++/foo'; + +allowing you to properly nest delimited options. + + Values are parsed with the following rules: =over 4
Re: r24846 - docs/Perl6/Spec
pugs-comm...@feather.perl6.nl writes: +C--prelude=Perl6-autoloop-no-print. Since eager matching is used, if you +need to pass something like: + ++foo -bar ++foo baz ++/foo ++/foo +you'll end up with + + %+OPTSfoo = '-bar ++foo baz'; That doesn't look very eager to me. Eirik -- So this is the Sword of Immortality? Huh? What's it doin' in a CRYPT?! --- John S. Novak, III, quoting an unnamed player
Re: r24846 - docs/Perl6/Spec
On Fri, Jan 9, 2009 at 13:16, Eirik Berg Hanssen eirik-berg.hans...@allverden.no wrote: pugs-comm...@feather.perl6.nl writes: +C--prelude=Perl6-autoloop-no-print. Since eager matching is used, if you +need to pass something like: + ++foo -bar ++foo baz ++/foo ++/foo +you'll end up with + + %+OPTSfoo = '-bar ++foo baz'; That doesn't look very eager to me. it's eager for the match to close, which is the opposite of greedy matching. in perl 5 documentation, it's called non-greedy. for use and explanation of the terminology, see http://perlcabal.org/syn/S05.html#Backtracking_control. ~jerry
Re: r24846 - docs/Perl6/Spec
jerry gay jerry@gmail.com writes: On Fri, Jan 9, 2009 at 13:16, Eirik Berg Hanssen eirik-berg.hans...@allverden.no wrote: That doesn't look very eager to me. it's eager for the match to close, which is the opposite of greedy matching. in perl 5 documentation, it's called non-greedy. for use and explanation of the terminology, see http://perlcabal.org/syn/S05.html#Backtracking_control. ~jerry If that's now the case, that's unfortunately confusing. In other contexts, eagerness is leftmost (eager for matching to start, if you like), which is orthogonal to greed: # Perl Cookbook illustration of eagerness, expanded to demonstrate # that the non-greedy case is equivalent: $string = 'good food'; if ($greedy) { $string =~ s/o*/e/; # 'egood food' } else { $string =~ s/o*?/e/; # 'egood food' } Why not stick to non-greedy, if that's what you mean? Surely that's not ambiguous? Eirik -- The basic facts are that the rate of decrease of the population growth rate has been falling for decades, at an ever increasing rate. --jsn...@netcom.com (John R. Snead)
Re: r24846 - docs/Perl6/Spec
On Fri, Jan 9, 2009 at 14:26, Eirik Berg Hanssen eirik-berg.hans...@allverden.no wrote: jerry gay jerry@gmail.com writes: On Fri, Jan 9, 2009 at 13:16, Eirik Berg Hanssen eirik-berg.hans...@allverden.no wrote: That doesn't look very eager to me. it's eager for the match to close, which is the opposite of greedy matching. in perl 5 documentation, it's called non-greedy. for use and explanation of the terminology, see http://perlcabal.org/syn/S05.html#Backtracking_control. ~jerry If that's now the case, that's unfortunately confusing. In other contexts, eagerness is leftmost (eager for matching to start, if you like), which is orthogonal to greed: # Perl Cookbook illustration of eagerness, expanded to demonstrate # that the non-greedy case is equivalent: $string = 'good food'; if ($greedy) { $string =~ s/o*/e/; # 'egood food' } else { $string =~ s/o*?/e/; # 'egood food' } Why not stick to non-greedy, if that's what you mean? Surely that's not ambiguous? i agree the wording isn't clear here, but it is consistent with the current design language. i don't want to define something with a negative, so i purposefully did not use non-greedy. i'll bring it up at the next design meeting, so the linguists can weigh in. ~jerry