On 2/9/2007 9:48 AM, Andrew Lentvorski wrote:
John H. Robinson, IV wrote:
Andrew Lentvorski wrote:
Also, Perl needs to suck it up and put named groups in its regex engine.

What is the benefit of:

    (?P<id>[a-zA-Z_]\w*)        m.group('id')

over
    ([a-zA-Z_]\w*)            $1
?

Why do so many Perl subroutines use named parameters rather than positional parameters?

Code maintenance.

Take a recursive descent parser, for instance. If I need to add another token in the middle or adjust the grammar rules, the tokens all rearrange which positional group they fall into.


Also the fact that $1, $2, etc. change value (or undef) when the next regex is run.

Karl


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to