develooper Front page | perl.perl6.language | Postings from June 2009

Re: Why pass by reference?

Thread Previous | Thread Next
From:
Martin D Kealey
Date:
June 18, 2009 23:19
Subject:
Re: Why pass by reference?
Message ID:
alpine.DEB.1.10.0906191814530.10800@feathers.sig.net.nz
On Fri, 19 Jun 2009, Martin D Kealey wrote:
> To that end I would propose that:
>  - parameters should be read-only AND invariant by default, and
>  - that invariance should be enforced passing a deep immutable clone
>    (*5) in place of any object that isn't already immutable.

Sorry, typo: that last word should have been "invariant", meaning that it
*won't* change, rather than "immutable", meaning that it *can't*.

Compilers can rely on invariance to perform a range of very powerful
optimizations; immutability is one way to guarantee invariance, but not the
only way.

-Martin

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