develooper Front page | perl.perl5.porters | Postings from April 2000

Re: PATCH: perlre.pod (against 5.6.0)

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
April 29, 2000 14:05
Subject:
Re: PATCH: perlre.pod (against 5.6.0)
Message ID:
4576.957042210@chthon
>ll153-4: Otherwise, the lefter one always wins.
>Cute though it is, I'd rather see something like 'the leftmost of the
>two'.

The problem with that, which I did consider, is that -most is in
the superlative degree, something that cannot occur when merely two
items are being compared.  For that, you need the comparative degree.

>l172: octal char (think of a PDP-11);
>Does 'think of a PDP-11' actually help anyone understand this?
>(I appreciate this phrase was not introduced by Tom's patch.)

Sure: if you learned macro assembler and C on a PDP-11, the way
many of us did.  :-)

>l179: \u      titlecase next char
>Not sure what 'titlecase' means, or why it is more accurate than
>'uppercase', nor why \U was not similarly changed.

Because that doesn't happen there.  "titlecase" is a Unicode notion.
(It's somewhat misleading, since it doesn't really understand proper
titlecasing rules in English.)  But some scripts (read: charsets)
allegedly distinguish between these.  That's why toke.c has
toUPPER_LC_uni for uc(), but toTITLE_LC_uni for ucfirst().

>ll577-580:
>  For reasons of security, this construct is normally forbidden if
>  the regex involves variable interpolation, unless the perilous C<use
>  re 'eval'> pragma has been used (see L<re>), or the variables contain
>  results of C<qr//> operator (see L<perlop/"qr/STRING/imosx">).

>I don't think this is correct.

>I _think_ the story is that without C<use re 'eval'>, you cannot combine
>variables and code within a regexp, but that you can put code into a
>qr// regexp (as long as you don't mix in variables to be interpolated),
>and then interpolate the variable containing the evalable qr// pattern
>along with other variables into a new pattern. Thus this is allowed:

>  $y = qr/(?{ "code here" })/;
>  /$x$y$z/;

>.. but these aren't:

>  $x = qr/./; /(?{ "code here" }) $x/;
>  $x = qr/(?{ "code here" }) $y/;

>l609: Execute I<code> and interpolate its result as more pattern.
>I think 'as a subpattern' might be more accurate, since you can't
>say, for example, /(??{ "(" }) . (??{ ")" })/.

I believe this is fundamentally broken.  I think Ilya simply screwed up.

>ll638-9:
>  This is mostly useful as an efficiency hack
>  to optimize of what would otherwise be "eternal" matches [...]

>"to optimize what would", "to break out of what would"?

It was supposed to be the former.  (Note comparative degree. :-)

>ll695-7:
>  Be aware, however, that this pattern currently
>  triggers a warning message under the C<use warnings> pragma or B<-w>
>  switch saying it C<"matches the null string many times">.


    % perl -we '/(a*)*/'
    Use of uninitialized value in pattern match (m//) at -e line 1.

    % perl -we '/\b*/'
    \b* matches null string many times at -e line 1.
    Use of uninitialized value in pattern match (m//) at -e line 1.

MRE says interesting things about all this.

>I was unable to find evidence of this in any version of perl I have
>here. I appreciate this sentence was not introduced by Tom's patch.

thanks,

--tom

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About