[Top][All Lists]

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

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

From: Mark H Weaver
Subject: Re: Guile BUG: What's wrong with this?
Date: Sat, 07 Jan 2012 11:38:55 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Bruce Korb <address@hidden> writes:
> On 01/07/12 07:00, Mark H Weaver wrote:
>> The right place to fix this would probably be in
>> `scm_i_string_start_writing' (strings.c).
> I think it too much effort for that function.  I looked at it.
> The problem is that you'd have to pass it the start and end points,
> that is, change its interface.

Ah yes, excellent point!

Indeed, it would not be enough for `scm_i_string_start_writing' to check
for an empty string.  Even for non-empty immutable strings, if the range
of character indices passed to a string mutator is empty, then no
characters will be changed, and therefore the operation should succeed.
`scm_i_string_start_writing' doesn't have enough information to detect
this case.

I see two choices:

* Modify the interface to `scm_i_string_start_writing' to give it the
  `start' and `end' indices.

* Add checks to all string mutation functions: if the range is empty,
  then avoid calling `scm_i_string_start_writing'.

The advantage to the first approach is that authors of future string
mutators won't have to remember to handle this case specially, and I
have very little confidence that they would.

I'll look into this.


reply via email to

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