HELP NEEDS Jocelyn Ireson-Paine November 1992 This module defines a macro, 'needs', which I use instead of 'uses' (see HELP USES). To load it, do lib needs; If you are running Eden, this will have been done for you. Many procedures that you write will refer to procedures defined in a library package. For example, if you are writing bugs for Eden, you may want to use the contents of library 'search'. You can ensure that these are loaded by inserting a command such as needs search; at the beginning of your file. If you are working on a program contained in several files, each of which needs the same library, you can have a 'needs' command in each of them. This is safe because 'needs' will load the library the first time it's mentioned, and remember that it's done so, so as to avoid loading it again. Like 'uses', 'needs' looks for files in the directories listed in 'popuseslist', which you can alter. The same list is used by the 'lib' command - see HELP LIB. For those who know how 'uses' works, 'needs' does not require its libraries to set a variable of the same name. Hence it is more convenient to use. As well as libraries, you can use 'needs' to load your own files. This is often convenient when developing large programs. It will do so automatically, if you add the name of your working directory to the system variable 'popuseslist'. If you want to know what directories are already in it, do popuseslist => When looking for library files, Pop searches 'popuseslist' from the head to the tail. Hence, if you want your file to override a system library of the same name, put your directory name at the front of the list. 'needs' and sections -------------------- If you have not encountered sections before, you can ignore this bit. For an explanation of them, see HELP SECTIONS. When loading a file, 'needs' switches into the top-level section, 'pop_section'. This means that if you have two different sections, section fred; ... needs myfile; ... endsection; section bert; ... needs myfile; ... endsection; it will be loaded in the same context in each one. That would also happen with 'uses', if the file contained an absolute section name, i.e. one starting with $- . However, sometimes we don't want it to, and then 'needs' is more convenient.