[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strings rationale
From: |
Marius Vollmer |
Subject: |
Re: strings rationale |
Date: |
06 Aug 2001 23:54:30 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.102 |
Eric E Moore <address@hidden> writes:
> (if (not (false-if-exception (string-set! str n #\q)))
> (begin
> (set! str (copy-string str))
> (string-set! str n q\q)))
But note that you can't just villy-nilly substitute modifying a string
with modifying a copy of that string. These are two very different
things. Mostly your function is either supposed to modify the string
it is handed from the outside, or it is supposed not to modify it. In
the first case it would be a violation of the specified behavior of
your function to modify a copy of the passed string, in the latter
case, it would be a violation to modify the passed string. The
situation where a function is allowed to change a string when it finds
this convenient should be very rare.
(With copy-on-write, all strings would be mutable, but could secretly
share storage behind the scenes.)
- Re: strings rationale, (continued)
- Re: making up language features, Sam Tregar, 2001/08/06
- Re: making up language features, Tom Lord, 2001/08/06
- Re: making up language features, Sam Tregar, 2001/08/06
- Re: making up language features, Klaus Schilling, 2001/08/07
- Re: making up language features, Chris Cramer, 2001/08/07
- Re: making up language features, Thien-Thi Nguyen, 2001/08/15
- Re: strings rationale,
Marius Vollmer <=
- Re: strings rationale, Eric E Moore, 2001/08/07
- Re: strings rationale, Alex Shinn, 2001/08/06
- Re: strings rationale, Marius Vollmer, 2001/08/06
- Re: strings rationale, Rob Browning, 2001/08/15
- was Re: strings rationale, Tom Lord, 2001/08/15