Deutsch   English   Français   Italiano  
<66e66ddf@news.ausics.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Date: Sun, 15 Sep 2024 15:17:20 +1000
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Avoid treating the stack as an array [Re: "Back & Forth" is
 back!]
Newsgroups: comp.lang.forth
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> <87o74r3kjo.fsf@nightsong.com>
 <66e4564c$1@news.ausics.net> <87cyl6396z.fsf@nightsong.com>
 <66e579f9$1@news.ausics.net> <878qvu2p2l.fsf@nightsong.com>
Content-Language: en-GB
From: dxf <dxforth@gmail.com>
In-Reply-To: <878qvu2p2l.fsf@nightsong.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <66e66ddf@news.ausics.net>
Organization: Ausics - https://newsgroups.ausics.net
Lines: 43
X-Complaints: abuse@ausics.net
Path: ...!news.roellig-ltd.de!open-news-network.org!weretis.net!feeder8.news.weretis.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.ausics.net!not-for-mail
Bytes: 3252

On 15/09/2024 2:10 am, Paul Rubin wrote:
> dxf <dxforth@gmail.com> writes:
>> Compiling under DX-Forth resulted in a code size of 23 and 26 bytes
>> respectively.  Under VFX ...
> 
> I can't help it if those compilers generate worse code for the locals
> version.  Can you conveniently try lxf?

Windows NT/Forth (32 bit):

( 67 bytes, 19 instructions )
( 87 bytes, 24 instructions )
 
>> Not only were you able to read forth code, the result was more
>> efficient. 
> 
> Sometimes it isn't too hard to read, sometimes it takes head scratching,
> and sometimes I can't make any sense of it.  The function Anton posted
> was an example that didn't make sense.  I remember thinking I might sit
> down and try to figure it out to rewrite it, but it doesn't seem worth
> the effort.

It would be no different were locals used.  It would still require one to
sit down and figure out what the code did.  The more experienced one is in
the language the easier it is.

Going back to the EMITS example:

- despite lack of comments you quickly deduced what it did
- stack operations were few and simple and still you didn't like it
- your ideal is that every stack operation should go, which is what
  you did

If one takes from forth that which makes it efficient, then one takes away
its reason for existence.  Unfortunately for forth, this is what locals
users are doing, whether they're aware of it or not.
 
> Anyway, if efficiency was important for that example, I'd use CODE.

In other words forth is not important to you.  I understand.  You've stated
Python is your language of preference.  Forth is mine and I'll program it
the best way I know how.