Deutsch   English   Français   Italiano  
<2024Dec20.105938@mips.complang.tuwien.ac.at>

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

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: How robust is INCLUDE
Date: Fri, 20 Dec 2024 09:59:38 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 32
Message-ID: <2024Dec20.105938@mips.complang.tuwien.ac.at>
References: <e2087f81f803be03f7b87c51f0e4cc8a@www.novabbs.com>
Injection-Date: Fri, 20 Dec 2024 11:10:23 +0100 (CET)
Injection-Info: dont-email.me; posting-host="ef73b703451f561fbeb7b70f8e0cfeac";
	logging-data="3564994"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/kTRxGkt8P4Xv5edGw5h1T"
Cancel-Lock: sha1:iFyEIu8Thl6I+Qtc9P0PFqudZQY=
X-newsreader: xrn 10.11
Bytes: 2143

mhx@iae.nl (mhx) writes:
>I wonder if the following code is (partially) ANS compatible, and
>if it is easy to understand what it does, especially the word MAIN3.

There is no definition of MAIN3 in what you posted, only a use, so no.

>What I need is a word that is passed parameters that define an index
>into an array that is not allotted yet. So neither the index nor the
>base address
>can be pre-computed.
>When the word executes (after much more code which
>finally sets up the data), it should access the array to fetch a byte at
>the indexed position.

From this description, what's wrong with

: array-c@ ( c-addr uindex -- c ) + c@ ;

?  But I expect that I missed something about your requirements.

In general, if you want a program to be easily understandable, avoid
iForthisms (especially where standard alternatives are
straightforwardly available.  Avoiding LOCALS| is also a good idea.
It's unintuitive and therefore harder-to-understand order of locals
was the reason why {: was standardized.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: https://forth-standard.org/
   EuroForth 2024: https://euro.theforth.net