Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Alex Newsgroups: comp.lang.forth Subject: Re: Dynamic programming in Forth Date: Tue, 14 Feb 2017 16:34:37 +0000 Organization: A noiseless patient Spider Lines: 19 Message-ID: References: <3cc99bb7-98df-41b6-a313-2e64e8a83e5c@googlegroups.com> <97f17def-4eb6-477a-bc87-e5274a2f5deb@googlegroups.com> <1fa6bb93-34af-48a8-bc6a-d556db1fc53f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 14 Feb 2017 16:32:48 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="efdebc5404b02d9094252a87d9828902"; logging-data="31679"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6y+LSE+kfVSjzCTmQ0MpLKP92OGQgEfY=" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 In-Reply-To: <1fa6bb93-34af-48a8-bc6a-d556db1fc53f@googlegroups.com> Cancel-Lock: sha1:zeugBlaGvsrCIkJR7oJ5jfduSM4= Xref: csiph.com comp.lang.forth:54852 On 2/14/2017 15:44, minforth@arcor.de wrote: > the additional charm that one can take advantage of Forth's > stack-cleaning CATCH/THROW mechanism Which is exacty how I feel about CATCH and THROW. They are, to me, not a means of indicating errors or exceptions, but a means of providing a type of checkpoint with backtracking. There are limitations; there's no guarantee that your newly depth-restored stack will have usable contents for example, or that some other global-ish variable or event hasn't hosed your environment. And restoring the input source is a hard trick, given that a THROW might happen a very long way indeed from the original CATCH. But given these known limitations, they're still a very useful pair of words. -- Alex