caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: [Caml-list] Re: immutable strings (Re: Array 4 MB size limit)
@ 2006-05-28 23:20 Harrison, John R
  2006-05-29  2:36 ` Martin Jambon
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Harrison, John R @ 2006-05-28 23:20 UTC (permalink / raw)
  To: Martin Jambon, Caml List; +Cc: Harrison, John R

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-06-07  0:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-28 23:20 [Caml-list] Re: immutable strings (Re: Array 4 MB size limit) Harrison, John R
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

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