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

[perl #107370] *{""} stringification

Thread Next
Father Chrysostomos via RT
July 27, 2012 00:09
[perl #107370] *{""} stringification
Message ID:
On Mon Jul 23 19:44:36 2012, wrote:
> * Father Chrysostomos via RT <> [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

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