[r6rs-discuss] [Formal] allow variable-length strings

From: Per Bothner <per>
Date: Wed Mar 21 16:03:17 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 Bothner
per_at_bothner.com   http://per.bothner.com/
Received on Wed Mar 21 2007 - 16:02:26 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC