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

Re: [perl #80628] [PATCH] __SUB__

Thread Previous | Thread Next
From:
Abigail
Date:
December 13, 2010 02:42
Subject:
Re: [perl #80628] [PATCH] __SUB__
Message ID:
20101213104245.GB29007@almanda
On Mon, Dec 13, 2010 at 11:32:45AM +0100, Johan Vromans wrote:
> [Quoting demerphq, on December 13 2010, 10:48, in "Re: [perl #80628] [P"]
> > This is why i proposed using a $^THIS_SUB "magic tied var" for the purpose.
> 
> Sounds like a very good idea to me.
> 
> My main objection against __SUB__ is that __XXX__ things are currently
> compile time constants, hence we must avoid introducing __XXX__ things
> that are not. It doesn't contribute to Perl's popularity.


I wouldn't say __END__ and __DATA__ (probably the most well-known, and
certainly the most used __XXX__ thingies) are "compile-time constants".

So, I don't really buy the "__SUB__ confuses me, because it isn't a
compile-time constant" argument.

__XXX__ things I know about, in order how often I see it used in code:

__END__:   Special token
__DATA__:  Special token
__WARN__:  Special literal for %SIG
__DIE__:   Special literal for %SIG

<huge gap>

__FILE__:  Compile-time constant
__LINE__:  Compile-time constant


Now, I'd prefer a short token, and I certainly don't mind having a variable,
so $^SUB now wins for me. But __SUB__ doesn't shout "compile-time constant"
to me. (What constant should it possibly be?)


Abigail

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