Calling Conventions and Pass By Reference

Yuval Kogman nothingmuch at woobling.org
Tue Sep 2 19:48:23 BST 2008


On Tue, Sep 02, 2008 at 20:29:31 +0200, Philip Newton wrote:

> 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.

In perl they are too, a scalar is a container not a value.

$x++ creates a copy of the value in $x and assigns it back to $x

The difference is that in perl we have no mechanism to refer to
values, but only to containers.

> If certain things tend to be immutable, you expect less action-at-a-distance.

This statement is true at much higher levels, too (e.g. object
attributes, complex data structures, files on disk).

-- 
  Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org  0xEBD27418



More information about the london.pm mailing list