REQUIRE has problems

JP Massar <[email protected]> Wed, 16 Apr 2003 22:00:41 -0700
Newsgroups gmane.lisp.corman
Message-ID <[email protected]>
The documentation in the following patch file explain it all.



(in-package :common-lisp)

;;; JP Massar.  04/16/03

;;; Problem:  (REQUIRE "foo" "C:/Lispcode/foo.lisp") -->
;;; An error occurred in function MAPC:
;;; Error: Not a list: C:/Lispcode/foo.lisp

;;; Problem:  (REQUIRE #\a) is technically legal.

;;; Problem:  REQUIRE calls PROVIDE.  I don't think that is correct
;;; semantics.

;;; Solution: Recode REQUIRE to call STRING on the module name,
;;; and to make pathname-list into a list if it is an atom.
;;; Also, comment out call to PROVIDE.

(defun require (module-name &optional pathname-list)
   ;; According to the Hyperspec
   ;; -- module-name is a string-designator
   ;; -- pathname-list is either NIL or a designator for a non-empty list
   ;;    of pathname designators.  A list designator (see Glossary)
   ;;    is either a list or a non-nil atom, which denotes the list of
   ;;    that atom.
   (let ((module-name (string module-name))
	(pathname-list
	 (if (listp pathname-list) pathname-list (list pathname-list))))
     (unless (find module-name *modules* :test #'string=)
       (when pathname-list
	(mapc #'load pathname-list)
	(return-from require))
       (or (%load-from-registered module-name)
	  (%load-from-default module-name)
	  (error "Cannot find required feature: ~A" module-name))
       ;; The Hyperspec does not say that REQUIRE should cause
       ;; PROVIDE to be called (i.e., that *modules* should be modified).
       ;; (provide module-name)
       )))


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/xaxhjB/hdqFAA/VygGAA/SyjtlB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/