On Apr 9, 9:37 pm, Elizabeth D Rather <erat...@[EMAIL PROTECTED]
> wrote:
> Tinkerer wrote:
> > Hello, I'm just starting forth..
> > The word buffer: has me worried.
> > The docs say its purpose is to allocate a temporary buffer
> > How temporary? Is there some limitation to its use, or is it just
> > another way of saying 'heap' as opposed to 'stack' ?
>
> You do not say what version of Forth you're using, but in the
> implementations I'm familiar with, BUFFER: is equivalent to the sequence
>
> CREATE <name> <number of bytes> ALLOT
>
> This actually creates a permanent allocation of data space, so there's
> nothing temporary about it. And it is *data space*, neither "heap" nor
> "stack".
>
> I suppose someone may have defined it using ALLOCATE (which *is* a
> temporary allocation), but if so, you then have an obligation to FREE
> the space at some point. I've never seen such a version, though, so I
> suspect that the word "temporary" in the documentation doesn't really
> mean it. Forth rarely uses temporary allocations or garbage collection,
> though some extensions to Forth do.
I would suggest, they wanted a buffer for temporary data and therefore
called the buffer temporary.
Try
SEE BUFFER:
if it shows something like
: buffer: create allot ;
then it allocates a static buffer that you cannot resize later.


|