develooper Front page | perl.perl5.porters | Postings from January 2018

Re: RFC: deprecate literal \v in patterns except under /x; /[#]/xx

Thread Previous | Thread Next
From:
Karl Williamson
Date:
January 1, 2018 18:32
Subject:
Re: RFC: deprecate literal \v in patterns except under /x; /[#]/xx
Message ID:
492e11b8-b39e-fe08-bb4a-532f8738410c@khwilliamson.com
On 01/01/2018 02:56 AM, Sawyer X wrote:
> 
> 
> On 12/31/2017 10:31 PM, Karl Williamson wrote:
>> I am proposing two deprecations
>>
>> First, using literal vertical space, such as a form feed or new line,
>> in a regular expression pattern unless that pattern is /x.  My guess
>> is that this is extremely uncommon, and that just about all such
>> occurrences would be from forgetting the /x.  So deprecating this
>> should affect hardly anyone.  The reason I believe it is uncommon is
>> that when displayed the pattern would look something like this:
>>
>>      abc
>>             def
>> or the def would overwrite the abc if the vertical space is a carriage
>> return.  If it is a newline, the def would appear under the abc, and
>> that might look ok.  I haven't come up with a way to grep cpan for
>> this that doesn't have false positive /x uses.
>>
>> The reason I want to do this is to detect and warn on instances like
>> this, and where the programmer forgot that '#' starts a comment.  This
>> deprecation will be helpful in that regard.
>>
>> Second, in order to make the new /xx modifier more useful (and yes,
>> this should have been made experimental) I want to deprecate '#'
>> occurring in a bracketed character class.  At a later date, given the
>> first deprecation as well, we could allow [...] to be split across
>> lines with comments about each component.
> 
> I couldn't follow whether these two are related.
> 

The first is a prereq for the second to be worthwhile

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