Nп/п : 30 из 93
 От   : Anton Ertl                          2:5075/128        14 авг 23 14:17:56
 К    : none) (albert                                         14 авг 23 17:33:03
 Тема : Re: Closures
----------------------------------------------------------------------------------
                                                                                 
@MSGID: <2023Aug14.161756@mips.complang.tuwien.ac.at>
46d9c335
@REPLY:
6b9e0d93
@REPLYADDR Anton Ertl
<anton@mips.complang.tuwien.ac.at>
@REPLYTO 2:5075/128 Anton Ertl
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID:
<2023Aug14.161756@mips.complang.tuwien.ac.at>
@RFC-References:

@TZUTC: 0000
@TID: FIDOGATE-5.12-ge4e8b94
albert@cherry.(none) (albert) writes:
>I finally understood what closures mean.
>In Forth parlance it is a search order that is kept with an
>Forth word.

That view leads down to boy compilers (in Knuth`s man-or-boy test),
and at best (if you save and restore the variables on function entry
and exit) dynamically-scoped Lisp.

>An environment is a wordlist,

A wordlist has only one instance of each word in a wordlist.

An environment in a statically-scoped language is a set of local
frames, where each local frame is created dynamically when the
function to which the frame belongs is called.  So if a function has
two instances at the same time (e.g., in recursion), a wordlist is
insufficient.

You can use wordlists to store the offsets of variable within the
frames, but you have to manage the frames separately.

- 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: https://euro.theforth.net/2023
--- xrn 10.11
 * Origin: Institut fuer Computersprachen, Technische Universitaet (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх