Deutsch English Français Italiano |
<v75mtl$18ed1$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ruvim <ruvim.pinka@gmail.com> Newsgroups: comp.lang.forth Subject: Re: recursion Date: Tue, 16 Jul 2024 15:52:20 +0400 Organization: A noiseless patient Spider Lines: 50 Message-ID: <v75mtl$18ed1$1@dont-email.me> References: <v6c8v0$3usoe$1@dont-email.me> <v71gpb$jsug$1@solani.org> <nnd$79e41f47$2235e236@caa216183355b959> <d8a7bf3190d012f4d6e588cf7f4f4ee1@www.novabbs.com> <2024Jul15.152917@mips.complang.tuwien.ac.at> <v73cm8$kvfk$1@solani.org> <v73tpv$qua9$1@dont-email.me> <v7591i$15jt2$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 16 Jul 2024 13:52:22 +0200 (CEST) Injection-Info: dont-email.me; posting-host="05037965d70775917512fbc76eaf0338"; logging-data="1325473"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+s6bMMgQ2GZZk2pvE44CUI" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:ZqrWCv8jwR5AkcD0sjZGwsaZJ2k= In-Reply-To: <v7591i$15jt2$2@dont-email.me> Content-Language: en-US Bytes: 2516 On 2024-07-16 11:55, Ruvim wrote: > On 2024-07-15 23:37, Ruvim wrote: >> >> >> An even more better and more general approach: >> >> : binom ... forward binom ... ; >> >> >> : binom ... forward:binom ... ; >> >> The later one can also be used as: >> >> : foo ... ['] forward:foo ... ; >> >> >> An advantage of this approach is that it is more general than the >> "recursive" word, and you also don't have to repeat the definition name. > > > One more advantage of this approach is that it works as expected when > the compilation word list is absent in the search order. Because the > reference in a definition is resolved once the forwarded word name is > placed in the same compilation word list (regardless of the search order). A low-level API (porcelain) to implement this functionality can be represented by the following words: forward-lit, ( -- x.lit-sys ) forward-call, ( -- x.call-sys ) compile-lit ( x x.lit-sys -- ) compile-call ( xt x.call-sys -- ) Or which names are better? Conceptually, the standard words can be defined as: : compile, ( xt -- ) forward-call, compile-call ; : lit, ( x -- ) forward-lit, compile-lit ; : literal state @ if lit, then ; immediate -- Ruvim