On 12/17/06, A. Pagaltzis <pagalt...@gmx.de> wrote:
* demerphq <demer...@gmail.com> [2006-12-17 19:10]:
> On 12/17/06, A. Pagaltzis <pagalt...@gmx.de> wrote:
> >Regular expressions are a language in their own right; they
> >should at least have their own kind of literal. Even Perl 5 is
> >not consistent enough in this regard.
>
> Got an example?
In the culture of computing, regex languages are mostly
considered second-class citizens, or worse. "Real" languages
like C and C++ will exploit regexes, but only through
a strict policy of apartheid. Regular expressions are our
servants or slaves; we tell them what to do, they go and do
it, and then they come back to say whether they succeeded or
not.
[...]
Coming from a C background, Perl has historically treated
regexes as servants. True, Perl has treated them as trusted
servants, letting them move about in Perl society better than
any other C-like language to date. [...] We need to empower
regexes with a sense of control (structure). It needs to be
just as easy for a regex to call Perl code as it is for Perl
code to call a regex.
---Larry Wall, Apocalypse 5
Im probably being thick, but i dont see the connection between the two.
A) You said that Perl doesnt consistantly treat regexps as a special
kind of literal.
B) Larry says that regexes should be able to call perl code as easily
as perl code can call regexps.
I dont see the connection between the two,
And ill add that I disagree with A as to the best of my knowledge perl
always treats regexps as a special literal, but I agree with B as
there are still serious issues with how embedded code in regexps
works.
And in an effort to include the word hate in this post, ill note that
blead is much less hateful about how it handles parsing regexes, with
much less handled by the tokenizer and much more by the regexp parser.
The fact that /a\N{U+7C}b/ is treated as /a|b/ in earlier perls is
pretty hateful.
Yves
--
perl -Mre=debug -e "/just|another|perl|hacker/"