Nп/п : 47 из 93
 От   : Kaz Kylheku                         2:5075/128        27 авг 23 05:45:38
 К    : none) (albert                                         27 авг 23 08:46:03
 Тема : Re: MAL : closures and recursion
----------------------------------------------------------------------------------
                                                                                 
@MSGID: <20230826125020.141@kylheku.com> eeb482f5
@REPLY:
f12b514d
@REPLYADDR Kaz Kylheku <864-117-4973@kylheku.com>
@REPLYTO 2:5075/128 Kaz Kylheku
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: <20230826125020.141@kylheku.com>
@RFC-References:
<20230819073816.564@kylheku.com>

@TZUTC: -0000
@PID: slrn/pre1.0.4-9 (Linux)
@TID: FIDOGATE-5.12-ge4e8b94
On 2023-08-26, albert@cherry.(none) (albert)  wrote:
> I tested it, and my implementation fails the dynamic scope test.
> But what is supposed to happen if `a is global (pervasive environment)
> here?
>
> (define a 12)
> (define fun () a)
> (define a 13)
> (fun)

If there is a top-level environment like in Common Lisp, then the
second definition of a is actually an assignment.

If there is a top-level lexical scope, then the second a is a new
lexical identifier unrelated to the first a, and so fun refers
to the 12 not the 13.

This is a just a matter of knowing the requirements in MAL.

> I have README`s in different directories. I don`t identify those, but I could.
> There is a list of filenames, and as soon as I change directory the i-node of
> the README  in this directory is filled in in the list.
> Is this the way the name `a is handled?

The static view of the lexical scope, like what a compiler or any other code
walker sees can be compared to directory structure, if we imagine a directory
structure in which subdirectories point to their parents, but parents don`t
know about the subdirectories.

The syntax of the program references scopes, and those scopes have parent
scopes. 

Lexical scopes are blueprints for something that happens at run-time;
there isn`t anything comparaible in file system directories.

If everytime we step into a directory, we got a new empty one in which
there are freshly created files that are either empty or have some specific
initial contents, ... maybe that would resemble scopes.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
--- slrn/pre1.0.4-9 (Linux)
 * Origin: A noiseless patient Spider (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    
                                                                                
В этой области больше нет сообщений.

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