From: Marcin 'Qrczak' Kowalczyk Date: 2002-10-01T06:47:46+09:00 Subject: Re: Where Is Method Call Precedence? Tue, 1 Oct 2002 05:25:04 +0900, Pixel pisze: > http://merd.net/pixel/language-study/various/mutability-and-sharing You are wrong that OCaml string constructor allocates a copy. OCaml Strings aren't copy-on-write so this would be expensive. # let f () = "aaa";; val f : unit -> string = # (f ()).[0] <- 'A';; - : unit = () # f ();; - : string = "Aaa" OCaml strings are technically mutable but they can't change the length. The mutability is generally used only to construct a new string by allocation and filling. A typo: not 'strcmp("hello")' but perhaps strcpy or strdup (non-std). In Ruby it's faster than strcpy under the hood because of COW. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/