Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: How do you remember the stack? Date: Sun, 28 Feb 2016 22:37:14 -0800 Organization: A noiseless patient Spider Lines: 22 Message-ID: <87si0ct42t.fsf@jester.gateway.pace.com> References: <07ab86b1-3681-47c0-80ea-d7bd908925e7@googlegroups.com> <87fuwxd1js.fsf@nightsong.com> <2016Feb16.082803@mips.complang.tuwien.ac.at> <86egc4sre0.fsf@molnjunk.nocrew.org> <4b862821-c8a5-47a6-b5f7-a9b242048b9c@googlegroups.com> <87wppote05.fsf@jester.gateway.pace.com> <6c5f2ad3-f29a-4582-8643-33a31127870a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="560a36ee31cc4bcf69e115b311f0cc5c"; logging-data="6247"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/c8TQW2wlw0gAZuUguFwI6" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:YV/ujKR1c5ZH5a1R+2mKsQLkbag= sha1:qn+wJkahOtyzWDQ03BtB9dTaz+k= Xref: csiph.com comp.lang.forth:45747 Julian Fondren writes: > Leo Wong. http://www.murphywong.net/hello/forth.htm Nice! > Or the convention that you just don't use them. Leave them to > make sense in context, and only use whatever toplevel words you > come out with. But that leads to a lot of confusion keeping the stack straight, unless you use locals freely. Traditional (stack juggling) Forth code I've seen tends to use factors the way other languages use local variables. > It also helps you follow Wong's advice of "Don't bury your tools" > (apart from how you sometimes bury them 'neath other tools.) Burying the factors (by naming or scoping) under the words they compose to seems ok, exposing everything in the global namespace for public use gets messy as the program gets bigger. C has in-function local variables but it still added static functions (visible only in the local module) after a while. Maybe one aspect of Forth philosophy is to just not allow the program to get that big, though.