[Ecls-list] (si:package-lock :cl t)

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Fri Mar 19 18:33:51 UTC 2010


On Thu, Mar 18, 2010 at 5:32 AM, Matthew Mondor <mm_lists at pulsar-zone.net>wrote:

> Hello,
>
> Since in Common Lisp, using the :USE option of DEFPACKAGE causes
> dynamic binding of exported symbols of the used package into the new
> package, DEFUN is able to override CL functions.  After checking out
> the ECL code, I found out that I can use (SI:PACKAGE-LOCK :CL T) to
> lock the COMMON-LISP package and cause an error to be signaled when
> trying to override a CL symbol this way.


The lock was indeed active, but deactivated by the compiler:


$ ecl
ECL (Embeddable Common-Lisp) 10.3.1
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.
Top level.
> (defun cos (x) (+ x x))

Attempt to redefine function COS in locked package.

Available restarts:

1. (CONTINUE) Ignore lock and proceed
2. (RESTART-TOPLEVEL) Go back to Top-Level REPL.

Broken at SI:BYTECODES. [Evaluation of: (SI:FSET 'COS #'(SI:LAMBDA-BLOCK COS
(X) (DECLARE (SI::C-GLOBAL)) (+ X X)))]
>> :q

> (require 'cmp)

;;; Loading #P"/Users/jjgarcia/lib/ecl-10.3.1/CMP.fas"
;;; Loading #P"/Users/jjgarcia/lib/ecl-10.3.1/sysfun.lsp"
("CMP")
> (defun cos (x) (+ x x))

COS

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://tream.dreamhosters.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20100319/61430a59/attachment.html>


More information about the ecl-devel mailing list