Matt Gushee wrote:
> Hello people--
>
> According to the documentation,
>
>   
>> If you don't care about initial capacity, a more elegant way to
>> create a new string buffer is to write:
>> SBUF" " clone
>>     
>
> However, according to my listener,
>
>   
>> (scratchpad) SBUF" " SBUF" " eq?
>>     
>
>   
>> --- Data stack
>> f
>>     
>
> ... from which I infer that the SBUF" " word actually creates a new
> string-buffer instance each time it is called. So, is there some
> non-obvious reason why it is preferable to use 'clone', or are the docs
> wrong/out-of-date?
>   
When SBUF" " and the like are put in a word, they are only actually 
called once, and the new string-buffer is stored inside the word's 
definition.  Hence, if you don't use clone, the same word will be used.  
For example, try the following snippet:

: sheeple SBUF" " ;

sheeple sheeple eq?
> BTW, the same question applies to BV{ } and, I would imagine, some other
> empty literal sequences.
>
>   


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to