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

Re: [perl #24250] "return" required in some anonymous closures

From:
Dave Mitchell
Date:
October 21, 2003 05:19
Subject:
Re: [perl #24250] "return" required in some anonymous closures
Message ID:
20031021121857.GA7867@fdgroup.com
On Tue, Oct 21, 2003 at 12:57:45PM +0200, Elizabeth Mattijsen wrote:
> Finally, I think it still is a (bad) hack to have constants in a 
> language as a sort of second class subroutines with all the oddities 
> involved (most notably, not being able to use constants in a double 
> quoted string).  So maybe we should keep it like it is (but document 
> it better) until we figure out what is best.  There are plenty of 
> other things in Perl5 that catch people unsuspectedly.  I think we 
> can live with it.

My attitude is:

* implementing bareword constants using subs is a hack, but
is the best we can do for Perl5.

* given that for Perl 5 we need a way of creating const subs, and given
that the current technique in constant.pm of using anon subs has
poorly-defined and fragile semantics that is likely to trip up casual
users of closures (hence this bug report), I think we need a different
mechanism for creating them.

* I can live with the idea that this new method be marked experimental,
that we don't advertise it, that is it never used outside of constant.pm,
and that the attribute is named 

    __llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch__

Dave.

-- 
"I do not resent critisism, even when, for the sake of emphasis,
it parts for the time with reality".
Winston Churchill, House of Commons, 22nd Jan 1941.



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