From: David Vallner Date: 2006-11-03T07:41:12+09:00 Subject: Re: str1 = str2 is not a copy?!? --------------enig9EE945A6973ADD854A747717 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Paul Lutus wrote: > Joe Ruby MUDCRAP-CE wrote: >> WHY is var line getting changed by operations on var base_name? >=20 > Because in most cases, variable names contain references for the sake o= f > efficiency. And I'm guessing the sake of simplicity too. The Ruby basic data item object is thus one-dimensional, objects hold data, and variables point to objects. Contrasting with C, where either variables hold data, or heap memory holds data, and variables point to heap memory, or (ye gods) C++, where references add yet another dimension to the variable / data relationship (and that you can override the behaviour to do something else when a data item changes the way it's being referenced arbitrarily), this is -much- simpler to understand (when learning as a first system, not if used to a PHPesque ad-hoc mixture of behaviours), and what's more important, it's easier to keep a single set of quirks to watch out for when using other peoples' code, or designing reusable code (e.g. to avoid clobbering a library's internal state, etc.); although it -is- a net loss of language expressivity. Indeed, AFAIK, even the predominant C++ practice is "pick pointers or references and stick with them throughout your code" for the common case. David Vallner --------------enig9EE945A6973ADD854A747717 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFSnQCy6MhrS8astoRAor5AJ97WkR/nzHVZyWVupeNu65fLKKZYwCfRqun Mg/Z9R2MrfpZyA9EYJweZ1k= =rBF0 -----END PGP SIGNATURE----- --------------enig9EE945A6973ADD854A747717--