develooper Front page | perl.perl5.porters | Postings from October 2016

Re: (\@a) = \($x,$y) in non-void context

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
October 26, 2016 08:13
Subject:
Re: (\@a) = \($x,$y) in non-void context
Message ID:
20161026081251.GN3128@iabyn.com
On Tue, Oct 25, 2016 at 09:53:33PM -0000, Father Chrysostomos wrote:
> Dave Mitchell wrote:
> > Given the amount of time (i.e. too much) that I've already spent on
> > reworking the AASSIGN op, I think I'm going to leave undef
> 
> By which I think you mean returning the rhs if the lhs is immortal.

Yes.

> I
> would say yes, let sleeping dogs lie; since it is not clear how things
> *should* behave, just preserve the existing behaviour.

Agreed.

> > and \(@a)
> > lvalue behaviour alone for now. I'll still merge the f(($a,@b, $c) = ())
> > fix though if people agree.
> 
> I may be too late, but what would the new behaviour be?  If I under-
> stand correctly, it would be that the number of elements on the
> rhs is returned in scalar context, but the elements on the lhs are
> returned in list context.  Is that right?

Yes. The scalar behaviour is unchanged. The list behaviour is changed in
the presence of aggregates on the LHS. Previously (($a,$b,@c,$d) = (1))
returned ($a); now it returns ($a,$b,$d). (($a,$b,$c) = (1)) returned,
and still returns, ($a,$b,$c).

> Is that what we want?

It's what I want ;-)

I've just pulled it into blead and pushed it (before I saw your email),
so I'll have to revert it if people agree otherwise.


-- 
"I do not resent criticism, even when, for the sake of emphasis,
it parts for the time with reality".
    -- Winston Churchill, House of Commons, 22nd Jan 1941.

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