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

Re: return of copies vs references

Thread Previous | Thread Next
From:
Piers Cawley
Date:
March 29, 2005 00:38
Subject:
Re: return of copies vs references
Message ID:
m2is3ayhh4.fsf@obelisk.bofh.org.uk
Darren Duncan <darren@DarrenDuncan.net> writes:

> At 7:10 AM +0100 3/29/05, Piers Cawley wrote:
>>Doesn't that rather depend on the type of the attribute? Personally, if I get
>>an object back from accessor method then I expect that any modifications of
>>that object's state will be seen the next time I look at the results of that
>>accessor method. This is a direct result of the way reference types work, and
>>the world is a better place because of it. If you want a (deep) copy of the
>>returned object you should say so:
>>    my $res = $object.attribute.clone;
>
> I recanted what you're replying to last week.  Essentially, I agree with you
> that references of non-scalar values should be returned by default, and that
> the method must do an explicit copy if that's what they want returned.  Things
> are much simpler that way, and its how Perl 5 worked. -- Darren Duncan

Bah! Must start keeping up to date with the list again.

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