Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connectionsDate: Sun, 15 Sep 2024 15:28:24 +1000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: dxf Subject: Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!] Newsgroups: comp.lang.forth References: <66d26c4b$1@news.ausics.net> <87bk0vbvgk.fsf@nightsong.com> <66e0fa58$1@news.ausics.net> <66e11d64$1@news.ausics.net> <877cbh4b6z.fsf@nightsong.com> <66e2a497$1@news.ausics.net> <2024Sep14.143207@mips.complang.tuwien.ac.at> Content-Language: en-GB In-Reply-To: <2024Sep14.143207@mips.complang.tuwien.ac.at> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit NNTP-Posting-Host: news.ausics.net Message-ID: <66e67077$1@news.ausics.net> Organization: Ausics - https://newsgroups.ausics.net Lines: 53 X-Complaints: abuse@ausics.net Path: ...!weretis.net!feeder9.news.weretis.net!news.bbs.nz!news.ausics.net!not-for-mail Bytes: 2703 On 14/09/2024 10:32 pm, Anton Ertl wrote: > dxf writes: >> On 12/09/2024 4:51 pm, Paul Rubin wrote: >>> dxf writes: >> https://pastebin.com/2xcRSbQW >> >>>> SWAP averaged 1 in 7 definitions. OVER 1 in 9. Is 'stack juggling' a >>>> problem in forth? It doesn't appear to be. > > : ARG ( n -- adr len -1 | 0 ) > >r 0 0 cmdtail r> 0 ?do > 2nip > bl skip 2dup bl scan > rot over - -rot > loop 2drop > dup if -1 end and ; I believe it's well written and efficient. : 2nip 2swap 2drop ; : end postpone exit postpone then ; immediate defer cmdtail ( -- adr len) : ARG ( n -- adr len -1 | 0 ) >r 0 0 cmdtail r> 0 ?do 2nip bl skip 2dup bl scan rot over - -rot loop 2drop dup if -1 end and ; VFX: ( 180 bytes, 44 instructions ) > The heavy use of global variables in this program also does not > support the idea that proper usage of the stacks makes locals > unnecessary. I see many small colon definitions and very few variables - global or local: integer #TERMS \ number of terminals in DTA file integer TERM \ working terminal# variable #DIGIT variable LEN integer MAXCHR The first two are necessarily global and would exist regardless. The remaining three are used by a group of functions with the view of keeping them simple. The alternative would be to carry them around as parameters shuffling them from one function to another. That seems worse to me.