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

Re: [perl #20682] [fix] @- array not visible in s///

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
February 21, 2003 14:35
Subject:
Re: [perl #20682] [fix] @- array not visible in s///
Message ID:
20030221222208.GF280@Bagpuss.unfortu.net
On Fri, Feb 21, 2003 at 09:44:28PM +0000, Ton Hospel wrote:
> In article <20030221155014.GB793@ratsnest.hole>,
> 	Enache Adrian <enache@rdslink.ro> writes:

> > the warn will be executed, even if the substitution failed.
> > The builtins that do i/o have of course side effects: flagging
> > them with 'd' in opcode.pl could be a solution. That will be
> > only marginally useful, though.
> > 
> 
> A better side-effect detector seems better though. I must admit i've never
> been bitten by it yet, but I sometimes do things like:
> $a[$b{$c} || die "Oops ! no $c in hash"] so I suppose id'd better not 
> combine that to s/.../$a[$b{$c} || die]/
> 
> Personally I'm not a fan of optimizations that are sometimes plain
> incorrect. But flagging side-effect operators  operators and ignoring
> overload and tie fetch seems an acceptable compromise.

Although we could also maintain a global (er, per ithread) count of tied
variables, and whenever it is zero use the current, optimised version.
I suspect that for most programs, most of the time, that would remain a
speed win.

Nicholas Clark

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