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

[perl #107370] *{""} stringification

Thread Next
From:
Father Chrysostomos via RT
Date:
July 27, 2012 00:09
Subject:
[perl #107370] *{""} stringification
Message ID:
rt-3.6.HEAD-11172-1343372937-252.107370-14-0@perl.org
On Mon Jul 23 19:44:36 2012, perl.p5p@rjbs.manxome.org wrote:
> * Father Chrysostomos via RT <perlbug-comment@perl.org> [2012-06-
> 14T20:56:39]
> > I think the only way to fix this properly is to make *{$foo}
> equivalent
> > to *{__PACKAGE__ ."::$foo"} in all cases where $foo is a string that
> > does not contain a package separator.
> >
> > That means that %{""} will refer to %:: in the main package, and to
> > %foo:: in the foo package.
> 
> This doesn't seem nuts to me, and I'm hard pressed to imagine it
> breaking any
> code that is not both cowboy and cavalier... but:
> 
> a) I'd like to hear if there are objections and
> b) how about we do a big ol' smoke?
> 
> If you make this change, and core doesn't break like crazy,

There is one snag: I can detach the current stash from the symbol table,
in which case its containing *foo:: glob cannot be found, since the
stash has no reference thereto.  I suggesting croaking in that case.  Is
it OK to croak when looking up a name outside of strict refs?  If so,
what should the error message be, ‘You must be nuts’?

package foo;
undef *foo::;
*{""}; # what does this do?

Maybe ‘Unable to create glob named ""’.  C.f., this old error (gone in
blead):

$ perl5.16.0 -e '\&{""}'
Unable to create sub named "" at -e line 1.


> I can even
> have a
> look at using Steffen's smoking machinery.  *Somebody* other than him
> has to
> learn to use it!

-- 

Father Chrysostomos


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