In <[EMAIL PROTECTED]>, Perl6 RFC Librarian writes:
:Originally, we had thought of adding Yet Another Regex Modifier; but to
:be honest, having 2 modifiers just for the newline is already confusing
:enough, for too many people. A third is definitely out.

We thought of a few other possibilities too. I think it is a shame you
did not mention them, and explain why your proposal is better.

I still like the idea of $$, as I described it in the original thread.
I've seen no comments for or against at this time. To recap:

>Perhaps '$$' to mean match at end of string (without /m) or at end
>of any line (with /m)? The p52p6 translator can easily replace
>references to $$ with ${$}.

:=head2 The $* variable
:
:'/s' and '/m' also have a lesser known side effect: they both override
:the setting of the $* special variable, which controls multiline related
:behaviour in regexes.
:
:Use of this special variable has already been deprecated at least since
:Perl5 first came out, more than 5 years ago. It is a very good candidate
:to be removed from Perl6 altogether, which would result in fewer
:gotcha's in the language. That is a Good Thing.

Has there not been an RFC to remove this yet? If not I'll write one.
(Or if someone else has more spare time on their hands and wants to
do it, please let me know.)

:=head2 Getting the old behaviour back
:
:You can't. Question is: do you really want to?
:
:=over 2
:
:=item *
:
:If you know your data can contain newlines, and you want to treat them
:as ordinary characters, you probably don't want to make an exception for
:a trailing newline, anyway.

So you _can_ recreate the original behaviour. Why did you just say you
can't?

:=head2 '/ms': combined '/m' and '/s'
:
:'/ms' still works as before. Internally, '/m' has taken over the job  of
:matching before a newline at the end of the string, simply because /$/m
:can match before I<every> newline.

Eh? Surely /$/ms would now only match _after_ the newline, or at end of
string, whereas before it would match before _or_ after any newline, or
at end of string?

:=head1 MIGRATION
:
:It's not unlikely that currently having /$/ in your regexes, is actually
:a bug in your script, but you don't care because the data won't ever
:make it visible.
:
:Therefore, I think it is not desirable to have the Perl5 To Perl6
:converter actually change your source code. A warning if /$/ is found in
:combination with a bare '/s' modifier, not combined with '/m', is
:probably all that is wanted.

This seems like a read bad idea. I think you have to assume people
are feeding you the code they want to run. At worst you should
generate a warning, but I think it is evil not to migrate things
properly.

I don't think changing /s is the right solution. I think this will
incline people to try and fix their problems by adding /s, without
realising that this changes the definition of every . in their
regexp as well. I like the idea of $$ better - this is a natural
and obvious extension to $, which adds a new capability without
messing with any existing capability. Furthermore people who find
that they have a problem in their existing regexp because $ does
not mean what they thought will not set themselves up for new and
different problems when they apply the obvious one-byte fix.

Hugo

Reply via email to