develooper Front page | perl.perl5.porters | Postings from June 2019

[perl #134125] Some incomplete expressions treated as valid

From:
Tony Cook via RT
Date:
June 20, 2019 01:08
Subject:
[perl #134125] Some incomplete expressions treated as valid
Message ID:
rt-4.0.24-7794-1560992909-342.134125-15-0@perl.org
On Tue, 11 Jun 2019 17:18:10 -0700, tonyc wrote:
> On Mon, 03 Jun 2019 23:36:37 -0700, tonyc wrote:
> > On Wed, 22 May 2019 11:33:05 -0700, public@khwilliamson.com wrote:
> > > These cases are extracted from [perl #112084]
> > > https://rt.perl.org/Ticket/Display.html?id=112084
> > > 
> > > filed by Tom Christiansen, the rest of which has been fixed or
> > > rejected.
> > > 
> > > % blead -wle 'print 0x - 1'
> > > 1
> > > % blead -wle 'print 0b - 1'
> > > -1
> > > % blead -wle 'print 0xx2'
> > > 00
> > > 
> > > Surely that's again an error? Those are the same kind of thing as
> > > this:
> > > 
> > > % blead -wle 'print 3.14e'
> > > Bareword found where operator expected at -e line 1, near "3.14e"
> > > (Missing operator before e?) Unquoted string "e" may clash with future
> > > reserved word at -e line 1. syntax error at -e line 1, near "3.14e "
> > > Execution of -e aborted due to compilation errors.
> > > Exit 255
> > 
> > Something like the attached?
> 
> Applied as 7259f4194f3131957240f6b3dba47b74f53ac660.

After some thought, I'd prefer to make this fatal instead.

In most cases adjusting the parse position will result in a later syntax error, but in a few cases with 0x it can result in a silent change in behaviour instead, which is bad.

The attached makes this fatal.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=134125



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