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

Re: `Final' lvsub patch: arrays and hashes

Thread Previous | Thread Next
From:
Stephen McCamant
Date:
January 5, 2001 09:54
Subject:
Re: `Final' lvsub patch: arrays and hashes
Message ID:
14934.2146.826983.504381@soda.csua.berkeley.edu
>>>>> "SC" == Simon Cozens <simon@cozens.net> writes:

SMcC> * What should
SMcC> 
SMcC> sub f :lvalue {@a}; f() = "foo\n"; print "@a";
SMcC> 
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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About