develooper Front page | perl.perl6.language | Postings from March 2005

Re: return of copies vs references

Thread Previous
From:
Larry Wall
Date:
March 16, 2005 23:53
Subject:
Re: return of copies vs references
Message ID:
20050317075320.GB11671@wall.org
On Wed, Mar 16, 2005 at 11:10:40PM -0800, Darren Duncan wrote:
: When I last asked a related question here, I was told that simply 
: returning an attribute will allow the caller to modify the original 
: attribute by default.

That used to be true for arrays and hashes, but I just changed my
mind on it.  (Scalars always copy.)

: I wanted to make sure this didn't happen.  It 
: is possible that there was a misunderstanding regarding the previous 
: question, and the default action is in fact a copy.

See my other message--it should make you a little happier.  I had
not sufficiently thought through what would happen with autogenerated
read-only accessors in scalar context.

Larry

Thread Previous


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