[Ecls-list] Overwriting cl functions

Peter Enerccio enerccio at gmail.com
Tue Jan 29 14:28:40 UTC 2013


Maybe I should explain what I am intending to do.

Basically, I want to overwrite open function to return my specific (gray)
stream. instead of usual stream that it would.
Ideally, all functions/macros that use open should use that function
instead, but I am not sure if it is possible.


2013/1/29 Matthew Mondor <mm_lists at pulsar-zone.net>

> On Tue, 29 Jan 2013 15:07:19 +0100
> Peter Enerccio <enerccio at 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 at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list
>



-- 
Bc. Peter Vaňušanik
http://www.bishojo.tk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20130129/97ad0c73/attachment.html>


More information about the ecl-devel mailing list