Re: SBCL funcallable-standard-class confusion



jtdubs@xxxxxxxxx wrote:
> I am having some problems related to SBCL's funcallable-standard-class
> that I'm hoping someone can help me sort out.
>
> test.lisp:
> -------------------------------
> (defclass fn ()
> ()
> (:metaclass sb-mop:funcallable-standard-class))
>
> (defmethod initialize-instance :after ((fn fn) &rest initargs &key
> &allow-other-keys)
> (declare (ignore initargs))
> (format t "Initializing ~A...~%" fn)
> (sb-mop:set-funcallable-instance-function fn
> (lambda (x)
> (format t "Calling ~A
> with ~A.~%" fn x)))
> (format t "Initialized ~A.~%" fn))
>
> (funcall (make-instance 'fn) 42)
> -------------------------------
>
> [jtdubs@Hiro:/Users/jtdubs]% sbcl
> This is SBCL 0.9.0, an implementation of ANSI Common Lisp.
> More information about SBCL is available at <http://www.sbcl.org/>.
>
> SBCL is free software, provided as is, with absolutely no warranty.
> It is mostly in the public domain; some portions are provided under
> BSD-style licenses. See the CREDITS and COPYING files in the
> distribution for more information.
> * (load "test")
> Initializing #<FN {4099EA55}>...
> Initialized #<FN {4099EA55}>.
> Calling #<CLOSURE (LAMBDA (X)) {4099F77D}> with 42.
> T
> *
>
> Hey, cool, I've created a self-referencing anonymous function without
> the Y-combinator! ;-)
>
> Google turned up a reference to this problem here:
> http://www.caddr.com/macho/archives/sbcl-devel/2003-5/1927.html
>
> That was from 2003. It seems to be the same issue. Any known
> workarounds? Any idea when this might be fixed? Anything I can do to
> help fix it?

Okay, so changing the lamba to a sb-kernel:instance-lambda makes it
work as designed. This was mentioned on the caddr.com link I posted
originally. Don't know how I missed that the first time through...

Anyway, the original question remains as to why this doesn't work with
lambda.

Justin Dubs

.



Relevant Pages

  • SBCL funcallable-standard-class confusion
    ... (declare (ignore initargs)) ... More information about SBCL is available at. ...
    (comp.lang.lisp)
  • Re: Abbreviated type declaration
    ... (declare (boolean x)) ... With CLisp and SBCL, this goes straightforwardly, but with CMUCL, I get ... 'boolean could theoretically be an implementation-dependent declaration, ...
    (comp.lang.lisp)