> Are you trying to figure out whether a particular file is the "main
> script" as opposed to being loaded from some other script?
Yes. There's no standard name for the behavior of bundling a package API
with a usable CLI in a single code file, so I've taken to calling it
"scripted main" and begun documenting on Rosetta
to achieve this in a variety of programming languages. Another word for
programs this is "modulino".
> One way to do this is to check your own variable *main* and bind it if
> it is not bound already. This is portable.
> Another way is to use SYS::*LOAD-LEVEL*, which is bound to incremented
> values by LOAD.
Yeah, so I'm looking for a simpler way to do this. Some languages expose
this via a variable, like $0, or a single function call.
Yet another way is EXT:ARGV
This isn't portable. It involves CLISP-specific parsing to reliably extract
the script name, so the same code can't be used in ECL, CCL, ABCL, ...
I like my code to be very portable.
> 2 years ago you asked about this here:
> can you offer a better rationale than then?
I agree that modifying the output of ext:*args* would break reverse
I agree that we don't want to break reverse compatibility.
So I'll tweak my suggestion and request that CLISP provides another
function much like ext:*args*, except that it exposes an equivalent to C's
An easy way to satisfy this is to make a function ext:*argv0*.