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

Re: [perl #80628] [PATCH] __SUB__

Thread Previous | Thread Next
From:
Florian Ragwitz
Date:
December 12, 2010 14:27
Subject:
Re: [perl #80628] [PATCH] __SUB__
Message ID:
87r5dmhbk8.fsf@tardis.home.perldition.org
Father Chrysostomos (via RT) <perlbug-followup@perl.org> writes:

> This patch adds a __SUB__ keyword that returns the current subroutine,
> or undef for the main program, a special block, or an eval.

Using '__SUB__' made me think it was a compile-time constant such as
__FILE__ and __LINE__. It isn't, so I think it's not very good naming.


Why not make it look like a regular function or keyword, such as

  sub {
      print "$_[0]\n";
      caller_cv(0)->($_[0] + 1) if $_[0] < $arg;
  }


In fact this is already available on CPAN as Devel::Caller. Is this
something common and useful enough to make it part of the core language?
I'm not really convinced of that.

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