Path: csiph.com!weretis.net!feeder9.news.weretis.net!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail From: zbigniew2011@gmail.com (LIT) Newsgroups: comp.lang.forth Subject: Re: Parsing =?UTF-8?B?dGltZXN0YW1wcz8=?= Date: Mon, 23 Jun 2025 05:05:57 +0000 Organization: novaBBS Message-ID: <9fa669bfbea72425cb4fa136cdb3ccdc@www.novabbs.com> References: <1f433fabcb4d053d16cbc098dedc6c370608ac01@i2pn2.org> <7e21117d37c506cccd8e79323c416fd1@www.novabbs.com> <1021bsd$31o0d$1@dont-email.me> <6ced001912d95b520dad9d25a6014342@www.novabbs.com> <60ca19340523b1ddfa4a2cbf1ac0995cb185cdcb@i2pn2.org> <6ea4ccd1cb6ae8c828144444fe51fea9@www.novabbs.com> <70a3014f99baf5e43b32e1320d7b8cd482be04c1@i2pn2.org> <61ff078b04e03c7b65b6dff98f58b80b@www.novabbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: i2pn2.org; logging-data="1657509"; mail-complaints-to="usenet@i2pn2.org"; posting-account="ovTHZ/VLht/KDF1nKqB7PmGhjiyfUdv/DKd8kGKFjRY"; User-Agent: Rocksolid Light X-Spam-Checker-Version: SpamAssassin 4.0.0 X-Rslight-Site: $2y$10$DKiqFsP5Fq7Gb44GLSsMp.imMwBHaYSeTHA8P3dyj1oOT7Es8UTwa X-Rslight-Posting-User: 8e58c9b6d1da98b6162b84d03d2307a6516add15 Xref: csiph.com comp.lang.forth:133798 On Sun, 22 Jun 2025 14:35:40 +0000, Hans Bezemer wrote: > On 20-06-2025 10:46, LIT wrote: > >> The claim made 40 years ago was: "Forth's heavy use of the stack for > >> parameter passing [...] it is easy for the beginner to run away with > >> the idea that the stack operators should be employed at every > >> opportunity." The suggestion being there's so much traffic one must > >> use stack juggling to solve it. > > > > How many years ago it was made — it doesn't that matter. > > Pythagorean theorem was made over 2500 years ago, and > > AFAIK it's still actual. > > > >> That's the fear and bogeyman that's regularly trotted out about > Forth. > >> But is it true? None of the colon definitions the authors provide > in > >> their book would indicate it. Each used 0, 1, 2 and occasionally 3 > >> parameters. Any variables they employed were sparse and global in > >> nature. > >> > >> How about more comprehensive applications? > > > > Then just compare the two examples from "my" > > thread "May the numbers speak". Is really the > > solution that uses strings of "r> drop nip s>d" > > etc. more clear and comprehensible? Oh, really? > > > > It's what we were talking about - not about > > "one of yours that had 154 colon definitions". > > > > -- > You can repair such things by using new stack paradigms. I've added > several ones, most of 'em inspired by others. E.g > > "swap 3OS with TOS" (SPIN, a b c -- c b a) > "DUP 2OS" (STOW, a b -- a a b) > > -- and several Return Stack operators like R'@, R"@ and RDROP. They're > not just shorthand, but also a template for stack manipulations. > > The R-stack operators are excellently suited to store (almost) > constants. The D-stack operators document the intentions of the > programmer. > > I'm sure your example comes from a "clean up" operation. It cleans up > the stacks. Most probably TOS is a return value, that has to be extended > to a double word (most likely because it is interfaced with a double > word word). > > One of the techniques I developed is to figure out which stack diagram > is most suited for the next set of operations. You do your stuff to get > there, document the resulting scheme - and the rest of your stack > manipulations are simple and shallow. > > But of course, you have to do the work. If you're incapable or too lazy > to do the work, yeah, then you will find Forth bites you. Note that C is > a very nice language as well. Beats Forth performance wise - so, what's > there not to like :) > > Hans Bezemer Mr. FIFO, that Forth of yours bites you from time to time? It must have rabies, or something. You may want to take it to the nearest vet. --