[Ecls-list] Overwriting cl functions

Peter Enerccio enerccio at gmail.com
Tue Jan 29 17:39:43 UTC 2013

Well I tried the shadowing import, compiles fine, but when attempting to
load that fas, it will throw redefinition error

(defpackage :test)

(in-package :test)

(shadowing-import 'open)
(defun open (filespec &key direction element-type if-exists
  (print "test")
  (cl::open filespec :direction direction :element-type element-type
        :if-exists if-exists :if-does-not-exist if-does-not-exist
        :external-format external-format))

2013/1/29 Juan Jose Garcia-Ripoll <juanjose.garciaripoll at gmail.com>

> On Tue, Jan 29, 2013 at 5:30 PM, Juan Jose Garcia-Ripoll <
> juanjose.garciaripoll at gmail.com> wrote:
>> On Tue, Jan 29, 2013 at 3:28 PM, Peter Enerccio <enerccio at gmail.com>wrote:
>>> 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.
>> This is the only instance where ECL contemplates redefinition. Use
>> (gray::redefine-cl-functions)
> Sorry, I misread again: you want _your_ own OPEN function. In this case
> why don't you shadow OPEN in your application and force it to return gray
> streams? All packages in your application will see the shadowed symbol.
> The other alternative, redefining OPEN, only works if you tell the
> compiler not to inline OPEN with a global (proclaim '(notinline open)), for
> otherwise it will use the C function in the generated code.
> Juanjo
> --
> Instituto de Física Fundamental, CSIC
> c/ Serrano, 113b, Madrid 28006 (Spain)
> http://juanjose.garciaripoll.googlepages.com

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

More information about the ecl-devel mailing list