Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Alexander Skobelev Newsgroups: comp.lang.forth Subject: Re: Region-based dynamic memory management idea Date: Tue, 10 Jun 2014 09:24:56 +0400 Organization: A noiseless patient Spider Lines: 24 Message-ID: References: <2014Jun8.152357@mips.complang.tuwien.ac.at> <2014Jun8.170536@mips.complang.tuwien.ac.at> <8b516815-aa73-4a26-83f8-c08558eb5c1e@googlegroups.com> <034bf13a-b0ac-45dc-94b1-fb5f2f593c49@googlegroups.com> <2462e7b0-6a5f-4886-b6c7-ca22f14f6651@googlegroups.com> <827a418d-4dd5-49da-b6f8-bd6b2379ac5c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="1c848eff29810dd3f356086626d96314"; logging-data="30715"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+FoYukJnaa88IKlYDG2/X2" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (darwin) Cancel-Lock: sha1:TkaHJqDHmmk1nKblckySo51jSfw= sha1:CjFjdiT85Wm/RKvJzc3eoIfIdk0= Xref: csiph.com comp.lang.forth:31365 Mark Wills writes: > On Monday, 9 June 2014 05:27:31 UTC+1, Alexander Skobelev wrote: >> That looks quite interesting, but could you please elaborate on >> what is a reason for using a separate string stack? It seems >> that you could implement all these string functions using just >> plain Forth stack, couldn't you? > > Sure you could, but (IMO) it would be very awkward to use. > > I assume you are talking about placing the contents of the string > on the stack? It's certainly possible (assuming your stack can > go deep enough) but it means accessing data underneath the strings > is really difficult. > > Perhaps you mean that only pointers are kept on the stack? That is > much more usable, but you then need to address the issue of > storing the strings in a heap, and dealing with the fragmentation > that results from things like dropping strings. That's what I > plan to tackle next. More as an excersise for me than anything > else... It's about the journey :-) Yes, I see now. I've mised the point you keep whole strings on the stack, not just their pointers.