Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: Back & Forth - Co-routines Date: Sat, 08 Feb 2025 23:07:11 -0800 Organization: A noiseless patient Spider Lines: 10 Message-ID: <87wmdzwq8w.fsf@nightsong.com> References: <874j1aycdt.fsf@nightsong.com> <3c3bdb056696f15c43fa512b5366002d@www.novabbs.com> <2025Feb6.135712@mips.complang.tuwien.ac.at> <3955434636b2a293c6a9c6d726ff6eae@www.novabbs.com> <2025Feb6.180659@mips.complang.tuwien.ac.at> <2cf9bd53562dae1241a161036e87cd6b@www.novabbs.com> <2025Feb8.120627@mips.complang.tuwien.ac.at> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Sun, 09 Feb 2025 08:07:25 +0100 (CET) Injection-Info: dont-email.me; posting-host="6c11e49378f2b8bdd1762a863972deb1"; logging-data="539922"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/xVnc1yC/O3QlERufPWgI1" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cancel-Lock: sha1:PKxKpdYJuadVeSOkrUubdkEJem0= sha1:4tbzn0TDtO4YhjVHuXo6wAJjynk= Bytes: 1979 minforth@gmx.net (minforth) writes: > Thanks, that makes sense. Each call to the outer function > creates a data record for (the contexts of) each of its inner > closure(s). The context records need to be managed somehow. Most languages with closures also have garbage collection, or anyway scope-controlled deallocation like in C++. It may not be obvious, but closures are sort of the same thing as OOP, just viewed from a different angle. Storage for the internal data of OOP instances has to be managed in about the same way.