Opened 9 years ago

Closed 9 years ago

#1253 closed defect (fixed)

utf8-srfi-13 string-map! does not update in-place

Reported by: Caolan McMahon Owned by: Alex Shinn
Priority: major Milestone: someday
Component: extensions Version: 4.10.x
Keywords: urf8, srfi-13 Cc:
Estimated difficulty:

Description

(use srfi-13)
(define str "foo")
(string-map! (lambda (c) #\x) str) ;; => "xxx"
str ;; => "xxx"
(use utf8-srfi-13)
(define str "foo")
(string-map! (lambda (c) #\x) str) ;; => "xxx"
str ;; => "foo"

Change History (4)

comment:1 Changed 9 years ago by Mario Domenech Goulart

Component: unknownextensions
Keywords: urf8 srfi-13 added
Owner: set to Alex Shinn
Status: newassigned

comment:2 Changed 9 years ago by Alex Shinn

This is intentional - it would be super slow to do otherwise.

comment:3 Changed 9 years ago by evhan

Would it be better to signal an error indicating that in-place mapping is unsupported? The current behaviour leads to more subtle bugs.

comment:4 Changed 9 years ago by Alex Shinn

Resolution: fixed
Status: assignedclosed

I really hate this API, but since the sole purpose is SRFI-13 compatibility I've gone ahead and fixed it to update in place.

If you know you might want to use the utf8 egg, you should never use string-map! in programs.

Note: See TracTickets for help on using tickets.