| Deutsch English Français Italiano |
|
<87o74r3kjo.fsf@nightsong.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin <no.email@nospam.invalid> Newsgroups: comp.lang.forth Subject: Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!] Date: Fri, 13 Sep 2024 03:38:51 -0700 Organization: A noiseless patient Spider Lines: 28 Message-ID: <87o74r3kjo.fsf@nightsong.com> References: <nnd$61e0ad9a$48ed61c2@b4d945e456041481> <vasqjd$icjm$1@dont-email.me> <66d26c4b$1@news.ausics.net> <vaubf7$tbke$1@dont-email.me> <nnd$04cff141$0193ba04@301336b8dd8ed69a> <vbfqnd$v4c4$1@dont-email.me> <nnd$26b4d59b$27bdb181@ce638e508b04426e> <87bk0vbvgk.fsf@nightsong.com> <66e0fa58$1@news.ausics.net> <66e11d64$1@news.ausics.net> <877cbh4b6z.fsf@nightsong.com> <66e2a497$1@news.ausics.net> <2024Sep12.121903@mips.complang.tuwien.ac.at> <66e37b37$1@news.ausics.net> <05fd5a0056972ac60f43598f23a170ad@www.novabbs.com> <66e40a42$1@news.ausics.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 13 Sep 2024 12:38:52 +0200 (CEST) Injection-Info: dont-email.me; posting-host="d658f2b46b9f2b400ce866659ce069dc"; logging-data="872939"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ppFgTBUdQHgfKtVPhMQGb" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cancel-Lock: sha1:qEPPIgFLIjJFmMByn1wKRT79RXc= sha1:el7tBIM6VjwwLFsMAl5rQo+XO6w= Bytes: 3147 dxf <dxforth@gmail.com> writes: >>> "I remain adamant that local variables are not only useless, they >>> are harmful. If you are writing code that needs them you are >>> writing, non-optimal code" - Chuck Moore 1999 ... > > Claims made in respect of locals in forth - ease of use, better > performance through less 'stack juggling', better > readability/maintainability - were all made in the 1980's. What has > changed? Forthers today are more willing to believe, to accept the > word of authority, lack the interest to discover the truth for > themselves? Is avoiding locals because of the Chuck Moore quote not an example of accepting the word of authority? And how often do even you care whether your code is optimal? It's likely difficult to get any interpreted Forth code to run at better than 1/5th the speed of assembly code. So if optimization is your main concern, why use Forth to begin with? I would say that the claim of better performance from locals depends on the implementation and in any case has to be scrutinized if it matters, but even if there's a performance loss, that might be an acceptable trade if the programmer finds offsetting gains in the other areas. My main programming language for random hacking is Python, which is possibly 10x slower than interpreted Forth or 50x slower than compiled Forth or C. Yet it usually doesn't matter unless I'm trying to do something unusually compute intensive. Once the program is fast enough to not be annoying to use, I don't need to optimize it more.