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

[perl #80628] [PATCH] __SUB__

Thread Next
From:
Father Chrysostomos via RT
Date:
June 12, 2011 18:18
Subject:
[perl #80628] [PATCH] __SUB__
Message ID:
rt-3.6.HEAD-16080-1307927901-1033.80628-15-0@perl.org
On Mon Dec 13 13:35:19 2010, jesse wrote:
> 
> 
> 
> On Mon, Dec 13, 2010 at 03:17:11PM -0500, Jesse Vincent wrote:
> > I'd rather this functionality live on CPAN until there's a clear
> consensus that it
> > should be in core and about what it should be named.
> 
> I somewhat misphrased this - We're very close to the
> contentious-feature-freeze for 5.14. And this is clearly contentious.
> I'd much rather it get better sorted out before we take it into blead.
> To me, it makes sense that it get beaten around a bit before we think
> about the eventual result for 5.16.

OK, now that we’re past that, let me address some objections that came up:

1) That __SUB__ is not a compile-time constant like its predecessors.

That __PACKAGE__ and __LINE__ are compile-time constants is an
implementation detail.
__PACKAGE__’s being a compile-time directive actually causes a bug in
some edge cases, so that is not set in stone.
__SUB__ *can* be a compile-time constant in subroutines that do not
close over variables. That optimisation just hasn’t been written yet.

2) That this should be a CPAN module, not part of core.

One reason I think we should have this in core is that JavaScript
supports it (arguments.callee), which makes Perl look bad.

And the symmetry with package/__PACKAGE__ is nice:
package foo { ...  my $pack = __PACKAGE__ ... }
sub     foo { ...  my $sub  = __SUB__     ... }


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