develooper Front page | perl.perl5.porters | Postings from February 2015

[perl #123814] grok_atou() for regexp quantifiers

Thread Previous | Thread Next
From:
Hugo van der Sanden via RT
Date:
February 19, 2015 12:39
Subject:
[perl #123814] grok_atou() for regexp quantifiers
Message ID:
rt-4.0.18-787-1424349577-1728.123814-15-0@perl.org
On Wed Feb 18 18:45:47 2015, jhi wrote:
> NOW would be the time to fix the API of grok_atou.
[...]
> Why NOW?  Because it has been only in 5.21.x

Oh, I hadn't noticed that it was so recent; in that case, strongly agreed.

> Off-hand, maybe it should have a special-special case of
> /^0+/ becoming zero.  Maybe.  As Hugo pointed out, the ugly
> octal case rears its 010 head.  Or maybe make it return
> boolean - in which case it cannot be an atoi drop-in-replacement any
> more.

Given we've already killed atoi uses, I don't think it's a big problem that it would no longer be a drop-in replacement.

I'll have a go at making a version that retains the strictness but returns boolean success, with target-type-specific variants. In the meantime I've pushed the branch hv/grok with what I think is the appropriate short-term fix for the primary issue in this ticket - I'd also like comments on whether we're happy to add a new failure message to cover /x{00}/ and /x{999999999999999999999999}/.

Hugo

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

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