develooper Front page | perl.perl5.porters | Postings from January 2001

Re: `Final' lvsub patch: arrays and hashes

Thread Previous | Thread Next
Stephen McCamant
January 5, 2001 09:54
Re: `Final' lvsub patch: arrays and hashes
Message ID:
>>>>> "SC" == Simon Cozens <> writes:

SMcC> * What should
SMcC> sub f :lvalue {@a}; f() = "foo\n"; print "@a";
SMcC> do?

SC> It should do @a = "foo\n";

I think we're agreed that that would be the most logical thing for it
to do, but do you have an idea how that could be implemented? At the
moment, that = is an OP_SASSIGN, and you need an OP_AASSIGN to do '@a
= "foo\n"'. In my opinion, adding runtime checks to pp_sassign or
sv_setsv() is something to avoid; either we should figure out how to
make this work at compile time, or make it an error.

 -- Stephen McC

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