Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: minforth Newsgroups: comp.lang.forth Subject: Re: Nested definitions Date: Wed, 2 Jul 2025 18:34:00 +0200 Lines: 24 Message-ID: References: <1f433fabcb4d053d16cbc098dedc6c370608ac01@i2pn2.org> <2025Jun23.071834@mips.complang.tuwien.ac.at> <1042s2o$3d58h$1@dont-email.me> <1043831$3ggg9$1@dont-email.me> <2025Jul2.171200@mips.complang.tuwien.ac.at> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net U1eC1bBTia2/qVu4FuCXSACPMxA+M1w9kVmDLJGY4WorZl1QJ0 Cancel-Lock: sha1:BRTosqlahr/ucZIwtkMkOKWMZew= sha256:HzcZQR4NBCraVueM7u51+aliDk8rZKV4ZwTZRaRUz1A= User-Agent: Mozilla Thunderbird In-Reply-To: <2025Jul2.171200@mips.complang.tuwien.ac.at> Am 02.07.2025 um 17:12 schrieb Anton Ertl: > Ruvim writes: >> On 2025-07-02 15:37, albert@spenarnc.xs4all.nl wrote: >>> Or it has not even know it, if [ is smart enough to compile a jump to >>> after ]. >> >> This can be tricky because the following should work: >> >> create foo [ 123 , ] [ 456 , >> >> : bar [ ' foo compile, 123 lit, ] ; > > 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. > Many roads lead to Rome. By accident, my quotations have read/write access to the locals of the parent function, but not vice versa. Apart from function encapsulation, the benefit is that I don't have to pass all quotation parameters over the stack, which makes the code very straightforward and readable.