Nп/п : 7 из 93
 От   : Kaz Kylheku                         2:5075/128        12 июн 23 16:28:19
 К    : All                                                   12 июн 23 19:33:08
 Тема : load with arguments and value returning.
----------------------------------------------------------------------------------
                                                                                 
@MSGID: <20230611202245.279@kylheku.com> 3fb80727
@REPLYADDR Kaz Kylheku <864-117-4973@kylheku.com>
@REPLYTO 2:5075/128 Kaz Kylheku
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: <20230611202245.279@kylheku.com>
@TZUTC: -0000
@PID: slrn/1.0.3 (Linux)
@TID: FIDOGATE-5.12-ge4e8b94
I`ve experimented with a feature and shipped it.

What if the load function could pass arguments to the loaded file?

I designed it like this.

1. Extra arguments in load get implicitly bound to a special variable
   called *load-args*.

2. If all the forms (or compiled forms) in the file are are evaluated,
   and terminate normally, load returns nil.

3. The loaded file can evaluate (return-from load) to prevent the
   remaining forms from being evaluated. Control passes to load.
   If (return-from load ) is specified, load will return
   that value, otherwise nil.

This may seem like a trifling thing, of no consequence, but it`s looking
like a "game changer". Loaded files can be functions now, and they can be
procedures that modify their behavior based on arguments.  It`s looking
very convenient for build scripting; doing the cruft around getting a
multi-component system constructed.

You can do a recursive load across a tree of files, while telling those
recursive loads to do different things: compile files, clean, ...

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
--- slrn/1.0.3 (Linux)
 * Origin: A noiseless patient Spider (2:5075/128)
SEEN-BY: 5005/49 5015/255 5019/40 5020/715 848 1042
4441 12000 5030/49 1081
SEEN-BY: 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



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

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