On Thu, Mar 18, 2010 at 5:32 AM, Matthew Mondor <span dir="ltr"><<a href="mailto:mm_lists@pulsar-zone.net">mm_lists@pulsar-zone.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<br>
<br>
Since in Common Lisp, using the :USE option of DEFPACKAGE causes<br>
dynamic binding of exported symbols of the used package into the new<br>
package, DEFUN is able to override CL functions.  After checking out<br>
the ECL code, I found out that I can use (SI:PACKAGE-LOCK :CL T) to<br>
lock the COMMON-LISP package and cause an error to be signaled when<br>
trying to override a CL symbol this way.</blockquote><div><br></div><div>The lock was indeed active, but deactivated by the compiler:</div><div><br></div><div><br></div><div><div>$ ecl</div><div>ECL (Embeddable Common-Lisp) 10.3.1</div>
<div>Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya</div><div>Copyright (C) 1993 Giuseppe Attardi</div><div>Copyright (C) 2000 Juan J. Garcia-Ripoll</div><div>ECL is free software, and you are welcome to redistribute it</div>
<div>under certain conditions; see file 'Copyright' for details.</div><div>Type :h for Help.  </div><div>Top level.</div><div>> (defun cos (x) (+ x x))</div><div><br></div><div>Attempt to redefine function COS in locked package.</div>
<div><br></div><div>Available restarts:</div><div><br></div><div>1. (CONTINUE) Ignore lock and proceed</div><div>2. (RESTART-TOPLEVEL) Go back to Top-Level REPL.</div><div><br></div><div>Broken at SI:BYTECODES. [Evaluation of: (SI:FSET 'COS #'(SI:LAMBDA-BLOCK COS (X) (DECLARE (SI::C-GLOBAL)) (+ X X)))]</div>
<div>>> :q</div><div><div><br></div><div>> (require 'cmp)</div><div><br></div><div>;;; Loading #P"/Users/jjgarcia/lib/ecl-10.3.1/CMP.fas"</div><div>;;; Loading #P"/Users/jjgarcia/lib/ecl-10.3.1/sysfun.lsp"</div>
<div>("CMP")</div><div>> (defun cos (x) (+ x x))</div><div><br></div></div><div>COS</div><div><br></div></div></div>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br><a href="http://tream.dreamhosters.com">http://tream.dreamhosters.com</a><br>