Re: Pre-Scheme static allocation
Michael Sperber <[email protected]> Thu, 29 Oct 2015 08:46:38 +0100
| Newsgroups | gmane.lisp.scheme.scheme48 |
|---|---|
| Message-ID | <[email protected]> |
Thomas Hintz <[email protected]> writes: > On Wed, Oct 28, 2015, at 01:03 AM, Michael Sperber wrote: >> But what you're trying to do still seems odd to me - maybe you can >> provide a little bit more background on why you're trying to do this? >> (I.e. why not just `(string-ref "hello-world" 0)`.) > > In this case I would like to keep a buffer of characters that are being > displayed on the screen. So I need to be able to do operations like > "string-ref" and "string-set!" on that buffer. But if I try to do this: > > (let ((buf "000000")) > (string-set! buf 0 #\a) > (string-ref buf 0)) > > the pre-scheme compiler inlines 'buf', which obviously is not what I > want. Primarily because it's not valid Scheme: The literal is read-only. I think what you should do is just a regular buffer, and, if you want to transfer contents from a literal string, do so explicitly. -- Regards, Mike