On Tue, 29 Jan 2013 15:07:19 +0100
Peter Enerccio <enerc...@gmail.com> wrote:

> Hello,
> 
> I wanted to ask if it is possible to overwrite functions in common-lisp
> package.
> I know I can do it in c level, but I would rather do it in lisp level, if
> it is possible.

The part that allows to unlock/lock packages is
implementation-dependent, but that can be done on ECL using the
function EXT:PACKAGE-LOCK (the COMMON-LISP package is locked by
default).  That said, it's also possible, and portable, to override a
COMMON-LISP package symbol in a specific package which USEs CL, like in
the following example, overriding GENTEMP in FOO:

(defpackage :foo
  (:use :cl))

(shadow 'gentemp :foo)
(defun foo::gentemp (&rest args)
  (error "Call to deprecated function GENTEMP with arguments ~S" args))

(in-package :foo)
(gentemp 4362642)

Condition of type: SIMPLE-ERROR
Call to deprecated function GENTEMP with arguments (4362642)
-- 
Matt

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list

Reply via email to