>>>>> "DAP" == Deborah Ariel Pickett <[EMAIL PROTECTED]> writes:
DAP> C<rule> allows us to define both named and anonymous rules, depending on DAP> context. C<rx> allows us to define only anonymous rules. C<rule> is DAP> the more general one, and you can use it exclusively if that's what you DAP> feel like. DAP> The only extra piece of syntactic sugar that C<rx> is giving us over DAP> C<rule>[*] is the ability to have arbitrary delimiters. If I were DAP> satisfied with always using C<{}> as delimiters for C<rx> then a DAP> program would run the same if I did a C<s:each/rx/rule/> on it. not in one case. if you had named rules then you couldn't do that substition as rx// has no syntax for a name. i assume you could use the := op to alias an rx to a name and that should be the same as a named rule. DAP> Now . . . DAP> Is there some _syntactic_ constraint (i.e., required by the parser) DAP> that requires C<rule> to use braces for delimiters? That is, shouldn't DAP> the following: DAP> $config_line = rule ($ident) { <$ident> = \N* } DAP> always be parseable for any given value of C<{> and C<}> (barring DAP> obvious exceptions like colons and parentheses)? no, rules are like subs there and only {} are allowed. DAP> Or, to put it more succinctly: do there exist two pieces of DAP> *syntactically correct* code like DAP> ... rule ... DAP> and DAP> ... rx ... DAP> (where the ... are identical in both) which each produce *valid* and DAP> *different* semantics? not that i can see. they are just syntactic variants with some slight differences (naming vs delimiters). DAP> To me, that'd be the only reason for C<rx> and C<rule> to be DAP> different keywords. [**] Especially since we're making such a big DAP> deal about patterns and subroutines having lots of parallels. DAP> The same parallel doesn't exist for subroutines[***]; why should DAP> it for pattern matching? rx// is closer to how qr// works and looks in perl 5. so if you just want to create a anon regex, then this would look familiar $re = rx/ blah / ; # whitespace always allowed now rule could be used there but it is longer and not similar to perl5 $re = rule { blah } ; DAP> [**] As opposed to C<rx> and C<rule> being two different spellings of DAP> the same keyword, something I don't object to. they aren't different spellings. they have different syntax but the same semantics. uri -- Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com ----- Stem and Perl Development, Systems Architecture, Design and Coding ---- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org