caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Harrison, John R" <johnh@ichips.intel.com>
To: "Martin Jambon" <martin_jambon@emailuser.net>,
	"Caml List" <caml-list@inria.fr>
Cc: "Harrison, John R" <johnh@ichips.intel.com>
Subject: RE: [Caml-list] Re: immutable strings (Re: Array 4 MB size limit)
Date: Sun, 28 May 2006 16:20:30 -0700	[thread overview]
Message-ID: <196F1D996F92CD46A542EA519DB8CE4703CCA9F0@orsmsx409> (raw)

Hi Martin,

| I disagree: has it ever happened to you to mutate a string by
accident?

The point is not that I will mutate a string by accident. I've never
done
it by accident or by design. The point is that I can't depend on code
that I call, or code that calls mine, not to subsequently modify strings
that are passed as arguments. So if I really need to reliably fix them I
am forced into expensive copy operations.

In practice, the obvious library calls are safe, so like Aleksey, I use
the built-in strings for the sake of convenience and compatibility. But
it's unsatisfactory intellectually. Some of us want to program in a
primarily functional style, yet the implementation of one of the most
basic and useful datatypes is not functional.

| Yes, so how do you avoid copies without using the "unsafe" conversions
all
| over the place?

With immutable strings, you'd never need to do conversions at the module
interfaces. As with any other functional data structure, you only copy
when you want to change part of it.

John.


             reply	other threads:[~2006-05-28 23:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-28 23:20 Harrison, John R [this message]
2006-05-29  2:36 ` Martin Jambon
2006-05-31 12:53 ` Jean-Christophe Filliatre
2006-06-05 20:54 ` immutable strings Matti Jokinen
2006-06-07  0:36   ` [Caml-list] " Jacques Garrigue
  -- strict thread matches above, loose matches on Subject: below --
2006-05-29 20:52 [Caml-list] Re: immutable strings (Re: Array 4 MB size limit) Harrison, John R
2006-05-15 18:12 Array 4 MB size limit akalin
2006-05-19  5:57 ` [Caml-list] " Frederick Akalin
2006-05-19 16:28   ` Jozef Kosoru
2006-05-19 21:26     ` Jon Harrop
2006-05-20  1:06       ` Brian Hurt
2006-05-20 21:11         ` immutable strings (Re: [Caml-list] Array 4 MB size limit) Oliver Bandel
2006-05-25  4:32           ` immutable strings (Re: " Stefan Monnier
2006-05-25  5:56             ` [Caml-list] " Martin Jambon
2006-05-25  7:23               ` j h woodyatt
2006-05-25 10:22                 ` Jon Harrop
2006-05-25 19:28                 ` Oliver Bandel
2006-05-25 11:14               ` Brian Hurt
2006-05-25 19:42                 ` Oliver Bandel
2006-05-26  6:51                 ` Alain Frisch
2006-05-25 17:31               ` Aleksey Nogin
2006-05-25 19:54                 ` Martin Jambon
2006-05-25 11:18             ` Brian Hurt
2006-05-25 17:34               ` Aleksey Nogin
2006-05-25 18:44                 ` Tom
2006-05-25 23:00                   ` Jon Harrop
2006-05-25 23:15                     ` Martin Jambon

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=196F1D996F92CD46A542EA519DB8CE4703CCA9F0@orsmsx409 \
    --to=johnh@ichips.intel.com \
    --cc=caml-list@inria.fr \
    --cc=martin_jambon@emailuser.net \
    /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;
as well as URLs for NNTP newsgroup(s).