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

[perl #107370] *{""} stringification

Thread Previous
From:
Father Chrysostomos via RT
Date:
July 27, 2012 10:39
Subject:
[perl #107370] *{""} stringification
Message ID:
rt-3.6.HEAD-11172-1343410783-1234.107370-14-0@perl.org
On Fri Jul 27 00:08:57 2012, sprout wrote:
> 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.

Actually, there is another:  I had forgotten when I made the above
proposal that certainly names are forced into the main package.

Currently, the rule is ‘any name not beginning with an idstart character’.

What I proposed above would change it to ‘any name that begins with a
non-idstart character’.

If we don’t change that rule, then the stash-detachment problem goes
away, and %{""} always refers to %::, resulting in a simpler
implementation and avoiding a potential problem.

And things will still round-trip properly, as \*{*{""}=~s/\*//r} ==
\*{""} will starting returning true.

-- 

Father Chrysostomos


Thread Previous


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