| Deutsch English Français Italiano |
|
<2025Jul3.103426@mips.complang.tuwien.ac.at> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Nested definitions
Date: Thu, 03 Jul 2025 08:34:26 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 33
Message-ID: <2025Jul3.103426@mips.complang.tuwien.ac.at>
References: <1f433fabcb4d053d16cbc098dedc6c370608ac01@i2pn2.org> <2025Jun23.071834@mips.complang.tuwien.ac.at> <a004d0f4acf945e054db77d86a4544fc@www.novabbs.com> <1042s2o$3d58h$1@dont-email.me> <nnd$42f4ab46$0b513441@af5c09ac13877827> <1043831$3ggg9$1@dont-email.me> <2025Jul2.171200@mips.complang.tuwien.ac.at> <1043of9$3k2oi$1@dont-email.me>
Injection-Date: Thu, 03 Jul 2025 10:43:18 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ece1e3634bb8dbb910c68a3b2f8c0ad2";
logging-data="97216"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19W4Ua7OK1I9IVSP9ELYme+"
Cancel-Lock: sha1:9gGbxQEufaapHgcE5D7aov8zmqA=
X-newsreader: xrn 10.11
Ruvim <ruvim.pinka@gmail.com> writes:
>On 2025-07-02 19:12, Anton Ertl wrote:
>> The benefit of defining a normal colon definition inside another colon
>> definition eludes me, however. Maybe mutual recursion, but the need
>> is rare and deferred words handle that well.
>
>As I can see, the idea is that the name of a nested definition has the
>limited scope — the same as a local variable, and it is not visible
>outside of the containing definition.
I have found the limited scope to be a hindrance, not a help: When I
want to debug, I want to call the word, but if it is not visible,
that's hard. There is a compromise: The scope recognizer allows to
invoke a word X in a vocabulary V with the syntax V:X:
vocabulary foo ok
also foo definitions ok
create foo1 ok
previous definitions ok
foo1
*the terminal*:9:1: error: Undefined word
>>>foo1<<<
Backtrace:
kernel/recognizer.fs:89:21: 0 $7FCA47A12FF8 throw
foo:foo1 hex. \ output: $7FCA47AA0DE8 ok
- 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 2023 proceedings: http://www.euroforth.org/ef23/papers/
EuroForth 2024 proceedings: http://www.euroforth.org/ef24/papers/