Path: csiph.com!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!] Date: Thu, 12 Sep 2024 00:10:03 -0700 Organization: A noiseless patient Spider Lines: 23 Message-ID: <8734m54ab8.fsf@nightsong.com> References: <66d26c4b$1@news.ausics.net> <87bk0vbvgk.fsf@nightsong.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Thu, 12 Sep 2024 09:10:04 +0200 (CEST) Injection-Info: dont-email.me; posting-host="b0d67a17825a951e78caf895a79278b8"; logging-data="148125"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jQD1mOlD/3TyEu2iTExo6" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cancel-Lock: sha1:UbZxZv7hC3OWMyoyCzu9dDlBob4= sha1:G6NLiT4UWWo3AGtoEczhHpcTz2A= Xref: csiph.com comp.lang.forth:132136 Hans Bezemer writes: > You comfortable left out the initialization of the stack > frame. Agreed, if ALL values are transferred to the return stack the > overhead is minimal. But how often happens that? I don't understand this. {: a b c :} transfers 3 elements from the parameter stack to the return stack. That has some cost, but it is offset by avoiding some DUP and similar operations. Is it relevant at all anyway? Old fashioned Forth interpreters are pretty fast, and if you're worrying about avoiding a stack transfer here or there, you need an optimizing compiler. Adding safety checks has a cost, but once the program appears debugged, I think Forth philosophy is to turn off the checks. > True - but that's not the level of abstraction I'm considering. I > think a language should have a well designed core, surrounded by a > constellation of extensions. Like C with its standard library and > Forth with its word sets. You might like Lua or Scheme for simple higher level languages with that style of design. C has some warts but its complexity in terms of keywords doesn't seem much worse than Forth's core words.