Hello bug-guile, I have a structure (srfi srfi-9 gnu) that keeps parts of strings in a binary tree (it's a rope). The intention was to have it immutable, so I used substring/shared. I kept getting errors on my unit tests when I referenced individual characters; I could not replicate these errors on the REPL. Eventually I realized that substring/shared caused them.
The manual says that unless a write is attempted, there is no CoW triggered. Yet something causes the character reads to access memory that probably shouldn't be accessed. I don't have a minimal reproducer yet, but I could probably furnish one. First I'd like to understand if I've done something wrong or if what I'm describing is actually a bug. Secondly, I've switched to substring/read-only now, which works fine. My issue with it however is that it appears that now I am performing cloning of the substrings, as substring/read-only is not sharing memory with the initial argument (or am I incorrect in this?) It's unfortunate that I cannot take ownership of mutable strings that the user passes to the rope data structure and treat them from then on as immutable. Regards, Nikolaos Chatzikonstantinou
