Deutsch   English   Français   Italiano  
<2024Oct3.175858@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: value-flavoured structures (was: Avoid treating the stack as an array)
Date: Thu, 03 Oct 2024 15:58:58 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 29
Message-ID: <2024Oct3.175858@mips.complang.tuwien.ac.at>
References: <nnd$61e0ad9a$48ed61c2@b4d945e456041481> <2024Sep13.200734@mips.complang.tuwien.ac.at> <66e4f98b$1@news.ausics.net> <2024Sep14.081952@mips.complang.tuwien.ac.at> <vc6t1b$27sna$1@dont-email.me> <2024Sep15.181634@mips.complang.tuwien.ac.at> <vd5pjl$kdp4$1@dont-email.me>
Injection-Date: Thu, 03 Oct 2024 18:31:58 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="edb3a3d11159eaa50edc5310324eeb6b";
	logging-data="3983317"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/Qf6LAZwMnn6Tam3QPCu1W"
Cancel-Lock: sha1:oT8vW4aE/VyvIflsxn6NDtJkjWc=
X-newsreader: xrn 10.11
Bytes: 2428

Ruvim <ruvim.pinka@gmail.com> writes:
>On 2024-09-15 20:16, Anton Ertl wrote:
>> A major merit for value-flavoured structures is that you can change
>> the field size (e.g, from 1 byte to 2 bytes or vice versa) without
>> changing all the code accessing those fields.  That's independent of
>> cell size.
>
>Yes, you can change the field size, but only as far as its value 
>occupies the same number of a stack items and the stack is the same.

Yes.  But you can switch between different sizes that all fit into a
cell, or between different memory sizes of floats without changing the
rest of the code.

>Similar for the word `to` - `to` applies to the words created with 
>`value`, `fvalue`, `2value`. But the source code around `to foo` (and 
>`foo`) depends on the kind of `foo`, so the kind of `foo` cannot be 
>changed without changing the source code around where it is used.

That's just as for reading the value-flavoured field; if a field
pushes one cell, TO to the field also consumes one cell; likewise for
float fields.

- 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