[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile BUG: What's wrong with this?

From: Mike Gran
Subject: Re: Guile BUG: What's wrong with this?
Date: Sat, 7 Jan 2012 07:20:30 -0800 (PST)

> From: Mark H Weaver <address@hidden>
> I wrote:
>>  3. Make scm_nullstr into a mutable string.  After all, it can't be
>>     changed anyway, and the _only_ reference to it is from
>>     scm_from_stringn, so the result should always be mutable.
> For the record: my statement above was in error; scm_nullstr is actually
> used in several files.  However, I looked at each use, and in all cases
> a mutable string is appropriate.  Also, it is SCM_INTERNAL.  So I
> committed the change.
> However, I wonder if we should also remove this optimization from
> scm_from_stringn, as Bruce suggested.  The R5RS says that `string' and
> `make-string' should return "a newly allocated string", which 
> implies
> that the new string should not be `eq?' to any existing object.

I threw in the optimization a couple of years ago into scm_from_stringn
only because I saw it used elsewhere in the code.  This was well before
Guile-2.0's switch of the immutable flag.  So there wasn't much thought
behind it.
> Although our docs for scm_from_stringn et al do not explicitly specify
> that the string is newly allocated, an argument could be made that we
> should follow the behavior of `string'.
> What do other people think?
>       Mark

reply via email to

[Prev in Thread] Current Thread [Next in Thread]