Hi Jon,

> I still don't get the difference this T makes. If I want to load two files
> with one 'load' call, when should I include the T?

To load two files, you can simply write (load "file1" "file2").

The T is there to get access to the remaining command line arguments.
This is typically needed in executable scripts.

For example, let's take the script

   #!/usr/bin/picolisp /usr/lib/picolisp/lib.l
   (load "@lib/misc.l")
   (doSomething)
   (bye)

This script completely ignores any possible command line arguments.

So you could 'load' the arguments, e.g.

   #!/usr/bin/picolisp /usr/lib/picolisp/lib.l
   (load "@lib/misc.l")
   (initSomething)
   (load T)  # Load the remaining args
   (doSomething)
   (bye)


For example, the build script for the 64-bit version uses this (see
"src64/mkAsm"). It first loads "@lib/misc.l", then extracts some further
command line arguments with 'opt', then 'load's some library files and
in the last line "defs.l" , "sys/xxx.defs.l", and finally the actual
source files using 'T'.


(load T) is similar to (apply load (argv)), with the difference that it
will "eat" the arguments, while 'argv' leaves them in place. For
example, the following script (let's call it "a")

   #!/usr/bin/picolisp /usr/lib/picolisp/lib.l
   (apply load (argv))
   (load T)
   (bye)

demonstrates this:

   $ ./a -"println 123"
   123
   123

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to