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

[perl #20510] lvalue references would be nice

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
September 23, 2014 15:34
Subject:
[perl #20510] lvalue references would be nice
Message ID:
rt-4.0.18-2010-1411486448-1471.20510-15-0@perl.org
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
https://rt.perl.org/Ticket/Display.html?id=20510

Thread Previous | 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