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

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

Dave Mitchell
October 21, 2003 05:19
Re: [perl #24250] "return" required in some anonymous closures
Message ID:
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 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,
and that the attribute is named 



"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. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About