Menu

#43 REQUIRE modules from the command line

open
UI (5)
5
2010-05-26
2010-05-26
No

Now that the default build uses dynamic modules, the users of non-base modules are likely to use the base linking set and use REQUIRE to load the modules they need (because the full linking set may contain a zillion modules they do not need and might actually not run because one of those zillion modules may require a missing external library).
This may make them want to be able to REQUIRE a module from the command line.
What we can do:
1. Do nothing. People can already do
$ clisp -x '(require "rawsock")' -repl

2. Make "-i" work as REQUIRE instead of LOAD, i.e., temporarily prepend libdir/dynmod to *LOAD-PATHS*:
$ clisp -i rawsock
this way the dynamic modules will override user files with the same name which may not necessarily always be what the user wants.

3. Add a new "-r" option to require the module, binding *load-paths* to NIL around the call to REQUIRE to ensure that no non-module files are considered:
$ clisp -r rawsock
will start clisp+rawsock and
$ clisp -r foo
will fail even if there is a file foo.lisp in *load-paths*.

Whatever course we take, the right way to write a script remains

#!/usr/bin/clisp
(require "rawsock")
...
==========

Discussion


Log in to post a comment.