[Ecls-list] Initialization of function metaobjects...

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Sun Nov 29 22:13:52 UTC 2009


This is the situation with CVS:

> (my-package::test)

"I was here!"
#<MY-PACKAGE::MY-GF MY-PACKAGE::FOO>
> #'my-package::foo

#<MY-PACKAGE::MY-GF MY-PACKAGE::FOO>
> (typep #'my-package::foo 'function)

T
> (typep (allocate-instance (find-class 'my-package::my-gf)) 'function)

NIL

The first three are OK. The last one is ok, because only initialized
instances are recognized as functions.

Juanjo

2009/11/29 Pascal Costanza <pc at p-cos.net>

> Hi,
>
> Another bug report: Consider the following example.
>
> (defpackage :my-package
>  (:use :common-lisp :clos))
>
> (in-package :my-package)
>
> (defclass my-gf (standard-generic-function)
>  ()
>  (:metaclass funcallable-standard-class))
>
> (defmethod initialize-instance :around
>    ((gf my-gf) &rest initargs)
>  (declare (dynamic-extent initargs))
>  (print "I was here!")
>  (call-next-method))
>
> (defun test ()
>  (eval '(defgeneric foo (x y z)
>          (:generic-function-class my-gf))))
>
>
> If I compile this, the load the compiled file, I get an error when running
> (test). Here is the transcript:
>
> > (in-package :my-package)
>
> #<"MY-PACKAGE" package>
> MY-PACKAGE> (test)
>
> The value of GF is #<MY-GF SI:UNBOUND>, which is not of type FUNCTION.
>
> Available restarts:
>
> 1. (STORE-VALUE) Supply a new value of GF
> 2. (RESTART-TOPLEVEL) Go back to Top-Level REPL.
>
> Broken at SI:BYTECODES. [Evaluation of: (DEFGENERIC FOO (X Y Z)
> (:GENERIC-FUNCTION-CLASS MY-GF))] In: #<process SI:TOP-LEVEL
> 00000001005c0f60>.
>
>
> This doesn't happen when I leave out the dynamic-extent declaration.
> Somehow, the si::no-check-type declaration for gf seems to get lost then
> (but that's just a guess on my side).
>
> It is indeed the case that (typep (allocate-instance (find-class 'my-gf))
> 'function) yields nil.
>
>
> Best,
> Pascal
>
> --
> Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
> Vrije Universiteit Brussel
> Software Languages Lab
> Pleinlaan 2, B-1050 Brussel, Belgium
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Ecls-list mailing list
> Ecls-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list
>



-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20091129/7a9d8cf2/attachment.html>


More information about the ecl-devel mailing list