Sujet : Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]
De : dxforth (at) *nospam* gmail.com (dxf)
Groupes : comp.lang.forthDate : 14. Sep 2024, 12:56:41
Autres entêtes
Organisation : Ausics - https://newsgroups.ausics.net
Message-ID : <66e579f9$1@news.ausics.net>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
User-Agent : Mozilla Thunderbird
On 14/09/2024 6:56 pm, Paul Rubin wrote:
dxf <dxforth@gmail.com> writes:
You have the source to my app. Perhaps you can nominate where locals
could have been used to better effect.
: EMITS ( n char -- ) swap 0 ?do dup emit loop drop ;
could be written:
: EMITS {: n char -- :} n 0 ?do char emit loop ;
Compiling under DX-Forth resulted in a code size of 23 and 26 bytes
respectively. Under VFX ...
( 71 bytes, 18 instructions )
( 102 bytes, 28 instructions )
Not only were you able to read forth code, the result was more efficient.
Perhaps locals in forth were meant to be clever? That would explain the
interest however it's high price to pay.