English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
Strings
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-04-03 (20:41)
From: Harrison, John R <john.r.harrison@i...>
Subject: RE: [Caml-list] Strings
| I can agree with you on this argument, but a question still remains:
| why should you ever do things like:
|
| > # s.[0] <- 'a';;

The point is that it might not be your own code that does it, but a
function written by someone else to which you innocently pass a string
argument. You may think you're writing purely functional code, but
unless you've checked all the other functions you're using that accept
or return strings, who knows?

Even if you aren't a doctrinaire functional programmer, the use of
mutable strings as the default weakens the abstraction boundary
provided by functions and procedures, and surely everyone agrees on
the importance of that.

John.