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

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

Path: ...!news.mixmin.net!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
Date: Fri, 04 Oct 2024 18:04:14 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 52
Message-ID: <2024Oct4.200414@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> <2024Oct3.175858@mips.complang.tuwien.ac.at> <vdo4q8$4h5p$1@dont-email.me> <2024Oct4.135221@mips.complang.tuwien.ac.at> <vdp0tf$80bg$1@dont-email.me>
Injection-Date: Fri, 04 Oct 2024 20:16:12 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="e836c6a0a468f0be540ff82074643594";
	logging-data="336965"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/DaevvF32YUOF4ZrKCPCBg"
Cancel-Lock: sha1:fOzOHF2NQm2QDxOZOQ3NzlwDpsk=
X-newsreader: xrn 10.11
Bytes: 3032

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.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