develooper Front page | perl.perl5.porters | Postings from September 2014

[perl #20510] lvalue references would be nice

Thread Previous
Father Chrysostomos via RT
September 22, 2014 22:59
[perl #20510] lvalue references would be nice
Message ID:
On Mon Sep 22 15:23:08 2014, wrote:
> * Father Chrysostomos via RT <> [2014-09-
> 21T16:35:33]
> > If *Other::x = \$y sets the imported flag, should \$Other::x = \$y do
> > the
> > same?
> Boy, that's a good question!

I have an even harder question regarding state variables, but it will take me some time to formulate it perspicuously.

> When I started thinking, I thought yes.  I convinced myself otherwise.
> \$x = \$y has, in this hypothetical future, a clear meaning.  Having
> it turn on
> the imported flag muddies its behavior.  I can think of it causing,
> but not
> alleviating, confusion.  If the mark-imported is desired, it can be
> gotten in a
> separate, explicit step... and I can imagine not always desiring it.
> Do you see some real value that I am missing?

I thought that perhaps exporter modules might switch to \&ThatPackage::foo = \&foo some day, to avoid the weird *foo = \&bar syntax (which was poorly designed IMO, since the lhs and rhs are not equal after the assignment).  We would need the imported flag to be turned on in that case.  I drew that conclusion only after asking the question.

Also, it’s easier to implement, since \$x=\$y where $x is a package var can just call the same internal function that ref-to-glob assignment uses.

Turning on the flag is what the implementation on the sprout/lvref branch currently does.  (It only works for scalars as yet.)


Father Chrysostomos

via perlbug:  queue: perl5 status: open

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About