Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

God requireth not a uniformity of religion. -- Roger Williams


devel / comp.lang.lisp / load with arguments and value returning.

SubjectAuthor
o load with arguments and value returning.Kaz Kylheku

1
load with arguments and value returning.

<20230611202245.279@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17421&group=comp.lang.lisp#17421

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: load with arguments and value returning.
Date: Mon, 12 Jun 2023 16:28:19 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <20230611202245.279@kylheku.com>
Injection-Date: Mon, 12 Jun 2023 16:28:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="90aa7781d06695f525299da707e112f2";
logging-data="3332813"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19SfiY5xhdSa/3ywc/JyqTB0FuXBJowAoc="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:3Av1VU6XekU1pXVnbZ0Vm4RYiqU=
 by: Kaz Kylheku - Mon, 12 Jun 2023 16:28 UTC

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 <value>) 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

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor