[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [spr8239] package-lock warning messages

] From: Eyvind Ness <eyvind.ness@hrp.no>
] Date: Thu, 29 Apr 93 7:14 GMT
]   ;; Date: Wed, 28 April 1993, 14:19 -0700
]   ;; From: Kevin Layer
]   ;;
]   ;; >> I'm also a bit annoyed by the persistence with which Allegro protects
]   ;; >> the built-in CL symbols - I can't even locally override CL fundefs
]   ;; >> within an FLET/LABELS without having a flood of warnings thrown at me.
]   ;; 
]   ;; This is discussed in the Allegro CL User Guide, page 3-25, volume 1.
]   ;; In short, you can disable package locking, though it is strongly
]   ;; discouraged.  You would not believe how many sprs we had because
]   ;; people did this:
]   ;; 
]   ;; 	(defstruct instance ...)
]   ;; 
]   ;; which obviously clashes with make-instance if package locking is not
]   ;; enabled.
] Yes. Yes. Most of us know already, I think. What is so strange, in my
] opinion, is that you can't *locally* override a cl-symbol within the
] body of an FLET or LABELS without getting lots of annoying warning
] messages. Note that I'm not making a permanent *change* to the
] cl-definition - it's only a *temporary* redefinition of it.

There's one more hazard you may not have thought of: some macro you
use in the body (or even a compiler macro) may expand into code which
uses the system function you have shadowed.  CLtL2 talks about this
on pages 259-261.  On the other hand, it sounds like you're willing
to take these risks.

] not found a proper way to bind EXCL:*ENABLE-PACKAGE-LOCKED-ERRORS* to
] NIL while compiling and using a macro-definition that expands to a
] function that uses FLET on a cl-symbol. What I have is something like:
] (defmacro franz-dislikes-this-macro (&rest body)
]  ...
]  `(let ((excl:*enable-package-locked-errors* nil))
]      ... 
]      . ,body))
The "let" is bound at the wrong time: at evaluation time, not
at compile time.  Since you're already doing all these other things,
you shouldn't mind using cltl1:compiler-let

(defmacro compile-without-package-locks (&rest body)
  `(cltl1:compiler-let ((excl:*enable-package-locked-errors* nil))

USER(35): (defun test-break (x)
	     (flet ((break (&rest x)
		      (format t "~&no brakes!")))
	       (when (> x 3)
	       (* x x))))
USER(36): (test-break 45)
no brakes!
USER(38): (compile 'test-break)
; While compiling (FLET TEST-BREAK BREAK):
Warning: variable X is never used
USER(39): (test-break 45)
no brakes!

John (boyland@cs.berkeley.edu)