[r6rs-discuss] [Formal] allow variable-length strings
per at bothner.com
Wed Mar 21 16:02:26 EDT 2007
Jon Wilson wrote:
> Is there any reason [string-append! returns] the unspecified value as opposed to
> returning str1 (post-modification)?
Most other mutating functions return the unspecified value.
> It seems that returning str1 would
> be more useful to a functional programming style.
Maybe. On the other hand it seems cleaner to distinguish between
"functional functions" versus "mutating functions". Having the
latter return the first parameter seems to confuse the issue.
On the third hand, would could use a "linear" style where a data
structure has a single reference so a pure functional expression
can can safely modify objects in-place..
> Additionally, this
> would make it a drop-in replacement for the existing string-append, in
> cases where modification of str1 is not harmful.
Also, a string-append! that returns the buffer can be a drop-in
replacement for SRFI-13s string-append/shared.
per at bothner.com http://per.bothner.com/
More information about the r6rs-discuss