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

Re: methods and bareword file handles, action at a distance, (un)speed

Thread Previous
From:
Nicholas Clark
Date:
June 14, 2010 01:38
Subject:
Re: methods and bareword file handles, action at a distance, (un)speed
Message ID:
20100614083807.GK31795@plum.flirble.org
On Mon, Jun 14, 2010 at 08:57:27AM +0100, Nicholas Clark wrote:

> Which reminded me what Artur said years ago - as well as action at a distance,
> there's a speed hit on every class method call because first the code does a
> stash lookup to see if the package name string is actually a filehandle:
> 
>     http://perl5.git.perl.org/perl.git/blame/086d2913:/pp_hot.c#l3108
> 
> So I wondered. Should we add a flag to pp_method and pp_methodnamed, to allow
> that lookup to be disabled, and add a lexical pragma to enable disabling.
> [And a better way to describe that :-)]

Oh, the fun you can have. This is Debian's stock 5.10

$ cat lax.pm 
fileno strict;
1;
$ perl -le 'use strict; ++$c; print "Ha!"'
Global symbol "$c" requires explicit package name at -e line 1.
Execution of -e aborted due to compilation errors.
$ perl -Mlax -le 'use strict; ++$c; print "Ha!"'
Ha!
$ 

Nicholas Clark

Thread Previous


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