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

Re: [perl #109542] $1 handled differently in integer arithmetics

Thread Previous | Thread Next
February 1, 2012 15:44
Re: [perl #109542] $1 handled differently in integer arithmetics
Message ID:
On 1 February 2012 22:39, Father Chrysostomos via RT
<> wrote:
> On Wed Feb 01 13:01:39 2012, wrote:
>> At 2012-02-01 12:35:00 -0800, wrote:
>> >
>> > But in the case of SvIV_please_nomg, we have already called magic (the
>> > whole raison d’être for the _nomg variant), so there is no reason not
>> > to treat SvPOKp as equivalent to SvPOK.
>> >
>> > Does that sound right?
>> It sounds right in principle, but it's not clear to me how to translate
>> that into a fix. In how many more places is that equivalence relevant,
>> and where must we add "|| SvPOKp(sv)"s to let them all through? Doing
>> it only in SvIV_please_nomg is insufficient. Or is there some easier
>> way to do it? Comments gratefully received.
> But how much other code is affected?  It is just the numeric ops?  It
> looks as though this will require what I call a bug hunt: grepping for
> instances and examining them for correctness.

Maybe we should back up a bit and consider why its ok that $+{match}
is fine in this context, and $1 isnt, and then figure out if we can
make $1 work like $+{match}.

Also, i am wondering, we have historically had a lot of trouble due to
the tied nature of $1 and $2 and the rest of the regex magic vars. I
am wondering why they have to be magic? Why don't we just copy the
values and be done with the bugs? If they were true globals, and we
populated them with localized LVALUES would we not get the same
effect, and indeed rid ourselves of the bugs and make them updatable

I mean, we have all the information and infrastructure to do this, is
there any reason not to?


perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About