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

[perl #20510] lvalue references would be nice

Thread Previous | Thread Next
Father Chrysostomos via RT
September 23, 2014 15:34
[perl #20510] lvalue references would be nice
Message ID:
On Mon Sep 22 15:59:35 2014, sprout wrote:
> I have an even harder question regarding state variables, but it will
> take me some time to formulate it perspicuously.

It’s not as knotty as I thought, if I think about it without reference to the implementation.

The question would have been:  Does \$x = \$y where $x is a state variable affect the internal state that records whether ‘state $x = ...’ has done that one-time assignment yet?

I think the answer is that is has no affect on it whatsoever (implementation complications aside).

But I have another question:

Now, I suppose we have to ask whether \state $x = \func() should call func() just once.  And *that* is a good question.  It complicates things in that we no longer have a simple rule for when ‘state’ governs assignment (when the thingy on the lhs is just state(...)).

What does Perl 6 do with state $x := $y?  Does state govern := as well as =?

It certainly seems useful for state to govern \...=, so is it worth adding that extra exception?


Father Chrysostomos

via perlbug:  queue: perl5 status: open

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