[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strings rationale
From: |
Eric E Moore |
Subject: |
Re: strings rationale |
Date: |
06 Aug 2001 20:43:20 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
>>>>> "Tom" == Tom Lord <address@hidden> writes:
Tom> No, you don't have to check for read-onliness before using
Tom> `string-set!'. `string-set!' checks internally, and signals an
Tom> error if passed an immutable string.
If you want your code to not throw errors, you have to check for
read-onliness. I thought we all assumed string-set! would throw an
error if passed a read-only string... Sure, you could do:
(if (not (false-if-exception (string-set! str n #\q)))
(begin
(set! str (copy-string str))
(string-set! str n q\q)))
or whatever, but you still need logic to check that the string
someone passed you is read-only or not... IMO, copy-on-write is
acceptable, but error throwing is a little messy. You could just
accept your code will fail on read-only strings, but that's not always
the friendliest thing to do.
-Eric
- strings rationale, Tom Lord, 2001/08/06
- Re: strings rationale, Neil Jerram, 2001/08/06
- Re: strings rationale, Alex Shinn, 2001/08/06
- Re: strings rationale, Tom Lord, 2001/08/06
- Re: strings rationale, Alex Shinn, 2001/08/06
- Re: strings rationale, Tom Lord, 2001/08/06
- Re: strings rationale,
Eric E Moore <=
- making up language features, Tom Lord, 2001/08/06
- Message not available
- apologies, Tom Lord, 2001/08/06
- Re: apologies, Neil Jerram, 2001/08/11
- 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, 2001/08/06