develooper Front page | perl.perl5.porters | Postings from July 2013

[perl #109744] referenced constant loses readonlyness

Thread Next
From:
Father Chrysostomos via RT
Date:
July 3, 2013 05:26
Subject:
[perl #109744] referenced constant loses readonlyness
Message ID:
rt-3.6.HEAD-2552-1372829200-969.109744-15-0@perl.org
On Wed Jun 26 17:25:09 2013, perl.p5p@rjbs.manxome.org wrote:
> Sprout has summed up my longstanding feelings about "constant" subs.
> I think
> they're a mess.  Automatic "constification" is not reliable, and I
> don't see a
> way to make it usefully reliable.  Making C< sub x(){42} > behave like
> C< sub
> x(){return 42} > seems like a lessening of the language's inner
> tensions.
> 
> Explicit constification, with 'use constant', is, well, explicit.
> Hooray!
> 
> (By the way, I was amused by this bit of verbal dodge in constant.pm:
> "It is
> not possible to have a subroutine or a keyword with the same name as a
> constant
> in the same package."  Heh.)
> 
> I am of course open to being convinced that I am totally wrong, but I
> feel
> pretty good about this... except, how much damage will be caused?
> 
> My hunch is "not much," considering the way that constant subs have
> been able
> to change over time, but then again, I'm guessing that sub x(){42}
> hasn't
> changed all that much.  We need some practical damage assessment.  If
> it looks
> like it's going to wreak havok, I'm not sure what the way forward
> along this
> path would be.

I have a branch ready, called sprout/padconst.  It hasn’t broken
anything in core except B tests, but those are extra sensitive.

Last I heard, smueller was not able to do full CPAN smokes.  I suspect
this will only break tests that check to make sure certain things can’t
work.  Data::Dump::Streamer’s tests will probably break.  I think it
will break PadWalker, too.

I expect the breakage to be small enough that we could merge this to
blead and see what happens over the next few months.  It should break
far fewer modules than last year’s hash and pad changes did.

May I merge it?  It will allow about 10 tickets to be closed.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=109744

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