[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] [Chicken-bugs] #433: symbols should be immutable
From: |
Chicken Scheme |
Subject: |
[Chicken-janitors] [Chicken-bugs] #433: symbols should be immutable |
Date: |
Sun, 13 Apr 2008 13:48:54 -0000 |
#433: symbols should be immutable
----------------------------------------------------------------+-----------
Reporter: sjamaan | Owner:
Type: defect | Status:
new
Priority: critical | Milestone:
Component: core libraries | Version:
3.0.0
Keywords: symbols, mutation, destructive procedures, strings |
----------------------------------------------------------------+-----------
When using {{{->string}}} on a symbol and calling a destructive string
procedure on the result, you mutate the original symbol everywhere it's
used. After that, the mutated symbol is not {{{eq?}}} to the same symbol
when made afresh.
{{{
#;1> (define x 'TEST)
#;2> (define y 'test)
#;3> (define z 'test)
#;4> (string-upcase! (->string y))
"TEST"
#;5> (eq? x y)
#f
#;6> (eq? y z)
#t
#;7> x
TEST
#;8> y
TEST
#;9> (eq? x 'test)
#f
#;10> (eq? x 'TEST)
#t
#;11> (eq? y 'TEST)
#f
#;12> (eq? y 'test)
#f
}}}
Not sure what the solution should be. Perhaps {{{->string}}} should just
make a copy, or the destructive procedures should make a copy when invoked
on an immutable string, or refuse to operate on immutable strings.
--
Ticket URL: <http://trac.callcc.org/ticket/433>
Chicken Scheme <http://www.call-with-current-continuation.org/>
The CHICKEN Scheme-to-C compiler
- [Chicken-janitors] [Chicken-bugs] #433: symbols should be immutable,
Chicken Scheme <=