Calling Conventions and Pass By Reference
philip.newton at gmail.com
Tue Sep 2 19:29:31 BST 2008
On Tue, Sep 2, 2008 at 20:18, Simon Wistow <simon at thegestalt.org> wrote:
> What other subtleties am I missing? What are the pros and cons from a
> language and culture perspective? From an underlying implementation and
> internals perspective?
>From a culture perspective, it also depends on which classes tend to
be mutable and which immutable.
For example, in certain languages, strings and primitive-wrapper
objects are immutable, so if you pass them to someone else, they can't
muck around with them. (The only thing they can do is take the
reference they were passed-by-value and make it point to a different
object, but that won't affect your copy of the reference, which will
still point to the original referent.)
If certain things tend to be immutable, you expect less action-at-a-distance.
Philip Newton <philip.newton at gmail.com>
More information about the london.pm