This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Here's what I want to do: "Efficient substrings via copy-on-write." The SUBSTRING primitive should work by sharing space with its source string, but both should be marked as shared, so that if either is side-effected, Guile will actually copy the string first. This gets us the semantics of a copy, with the performance of sharing. C code needs to be a little careful, calling a SCM_BREAK_SHARING macro before mutating a string, but we've got restrictions like this already. Code review solves this problem. We can get rid of read-only strings. We can get rid of the MAKE-SHARED-SUBSTRING primitive. This will need to interact nicely with threads, but I believe there are ways around that. If we have the above, then we can implement symbol->string using sharing, making it efficient enough that separate primitives which accept symbols as strings (like const-string-append) will be unnecessary.