What is Python's answer to Perl 6?
Reinhold Birkenfeld
reinhold-birkenfeld-nospam at wolke7.net
Sat Oct 30 11:20:52 EDT 2004
A.M. Kuchling wrote:
> On 30 Oct 2004 15:42:46 +0300,
> Ville Vainio <ville at spammers.com> wrote:
>> Well, if they are any good we'll just port them to Python. "import
>> re2" and we are all set. Everyone wins.
>
> I don't think so. Perl5 regexes are pretty independent of the rest of the
> language, but Perl6's are interweaved with the rest of Perl's syntax, so I
> don't think we'll ever see a Perl6-equivalent of PCRE.
The interweaving is only important if you "design your program as one
big regex" ;). There is the possibility of embedded closures, OK, but
one can live without it.
The assignment of variables in regexes can surely be reproduced in a
PCRE lib.
And I can imagine to wrap up the Perl6 concept of grammars in a class
that then can resolve referenced regexes.
(Perl6 proposes this sort of syntax for grouping regexes:
grammar Some_Grammar {
rule identifier { [a-z]* }
rule plus_expression { <identifier> \+ <identifier> }
etc.
}
)
I just think that the new RE syntax is much cleaner and easier to read.
We'll see how other languages adapt or not.
Reinhold
--
[Windows ist wie] die Bahn: Man muss sich um nichts kuemmern, zahlt fuer
jede Kleinigkeit einen Aufpreis, der Service ist mies, Fremde koennen
jederzeit einsteigen, es ist unflexibel und zu allen anderen Verkehrs-
mitteln inkompatibel. -- Florian Diesch in dcoulm
More information about the Python-list
mailing list