From: "Ralph Douglass" <ralph@grayskies.net>
To: "Caml List" <caml-list@inria.fr>
Subject: Re: [Caml-list] confusion about mutable strings
Date: Mon, 11 Feb 2008 08:46:15 -0500 [thread overview]
Message-ID: <71767b800802110546p827d48dy4fc883594c4b3f27@mail.gmail.com> (raw)
In-Reply-To: <6f9f8f4a0802110201k5e81e65ft7dcbb9773be34f76@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]
Sorry, I was indeed informed today by someone at work that it was talked
about a week or two ago. There is so much going on on the list that I just
missed it. And now I added noise myself. Sigh.
Thanks,
Ralph
On 2/11/08, Loup Vaillant <loup.vaillant@gmail.com> wrote:
>
> 2008/2/11, Ralph Douglass <ralph@grayskies.net>:
> >
> > Observe the following:
> >
> > # let foo () =
> > let bar = [|'a';'b';'c'|] in
> > Array.iter (Printf.printf "%c") bar;
> > bar.(0) <- 'd';
> > bar;;
> > val foo : unit -> char array = <fun>
> > # foo ();;
> > abc- : char array = [|'d'; 'b'; 'c'|]
> > # foo ();;
> > abc- : char array = [|'d'; 'b'; 'c'|]
> >
> > Why does OCaml treat these two examples in such a different manner? Is
> > there a reason why strings are magically special in this way?
>
> C strings are usually "magically special" in exactly the same way. It
> has been talked about in another thread (dunno how to look for it).
> Basically, this is a design choice meant for better performance.
>
> Loup
>
--
Ralph
[-- Attachment #2: Type: text/html, Size: 1649 bytes --]
next prev parent reply other threads:[~2008-02-11 13:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-10 17:46 Ralph Douglass
2008-02-10 18:03 ` [Caml-list] " Bünzli Daniel
2008-02-11 0:22 ` Ralph Douglass
2008-02-11 10:01 ` Loup Vaillant
2008-02-11 13:46 ` Ralph Douglass [this message]
2008-02-12 19:33 ` Ashish Agarwal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=71767b800802110546p827d48dy4fc883594c4b3f27@mail.gmail.com \
--to=ralph@grayskies.net \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox