Sujet : Re: value-flavoured structures
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.lang.forthDate : 04. Oct 2024, 19:04:14
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2024Oct4.200414@mips.complang.tuwien.ac.at>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : xrn 10.11
Ruvim <
ruvim.pinka@gmail.com> writes:
On 2024-10-04 15:52, Anton Ertl wrote:
It can be defined: Gforth has SET-TO
...
I wonder why a kind of "TO" is not used to set this field/property, and
*maybe* a kind of "ACTION-OF" to get this property.
Interesting idea. Maybe in some future version.
However, lots of Forth programmers have defined VALUEs, and barely any
have defined getters and setters.
>
Do you mean that this is due to some advantages in *using*?
>
I think, this is because `VALUE` (and co.) is a very old technique that
is provided out of the box by many systems.
Yes. Writing getters and setters is also provided out of the box.
variable addr-x
: x addr-x @ ;
: set-x addr-x ! ;
For some reason, people have not written getters and setters. The
lack of flexibility of standard TO has not deterred them from using
that.
In contrast, to use
separate getters and setters you need to create your own tool to define
them.
Obviously not, see above. What tool do you have in mind?
The discussions have been aboyt
values vs. variables, not about values vs. getters and setters.
>
This shows that some people don't like the to-based approach.
Does it? Are they using getters and setters instead? No.
I seen that some implementers provide "value" and "to" only for third
party programs and don't use them themselves.
Which ones? Typing WHERE TO right after startup in Gforth and in
SwiftForth shows a number of uses of TO in both systems.
- anton
-- M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.htmlcomp.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