Here is the offending code:
(defclass game-map () ((y1 :accessor y1)))
It causes an error in CLISP.
It sure looks like a bug in CLISP v2.33 and just did a quick check
on v2.35. The allegro telnet accessible LISP doesn't have any problems
with the code.
Also changing the accessor to yy1, removes the complaints.
Is it a Bug or some newbie foolishness?
(ps: can the error reporing be coaxed into giving line numbers)
The full error message is:
NO-APPLICABLE-METHOD: When calling #<GENERIC-FUNCTION FIND-METHOD> with
arguments (#<ADD-ON-SYSTEM-FUNCTION Y1> NIL (GAME-MAP) NIL), no method
is applicable.
[Condition of type METHOD-CALL-TYPE-ERROR]
Restarts:
0: [ABORT] Abort handling SLIME request.
Backtrace:
0: frame binding variables (~ = dynamically):
| ~ SYSTEM::*FASOUTPUT-STREAM* <--> NIL
1: EVAL frame for form (DEFMETHOD Y1 ((CLOS::OBJECT GAME-MAP))
(DECLARE (COMPILE)) (SLOT-VALUE CLOS::OBJECT 'Y1))
2: EVAL frame for form (LET NIL (EVAL-WHEN (COMPILE LOAD EVAL)
(CLOS::ENSURE-CLASS 'GAME-MAP :DIRECT-SUPERCLASSES (LIST) :DIRECT-SLOTS
(LIST (LIST :NAME 'Y1 :ACCESSORS '(Y1) :READERS '(Y1) :WRITERS
'(#1=(SETF Y1)))))) (DEFMETHOD Y1 ((CLOS::OBJECT GAME-MAP)) (DECLARE
(COMPILE)) (SLOT-VALUE CLOS::OBJECT 'Y1)) (DEFMETHOD #1#
(CLOS::NEW-VALUE (CLOS::OBJECT GAME-MAP)) (DECLARE (COMPILE)) (SETF
(SLOT-VALUE CLOS::OBJECT 'Y1) CLOS::NEW-VALUE)) (FIND-CLASS 'GAME-MAP))
3: EVAL frame for form (DEFCLASS GAME-MAP NIL ((Y1 :ACCESSOR Y1)))
4: EVAL frame for form (SWANK:LISTENER-EVAL "(defclass game-map ()
((y1 :accessor y1)))")
5: EVAL frame for form (SWANK:START-SERVER
"c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/slime.2836")
Geoffrey King wrote:
> Here is the offending code:
> (defclass game-map () ((y1 :accessor y1)))
>
> It causes an error in CLISP.
>
> It sure looks like a bug in CLISP v2.33 and just did a quick check
> on v2.35. The allegro telnet accessible LISP doesn't have any problems
> with the code.
>
> Also changing the accessor to yy1, removes the complaints.
>
> Is it a Bug or some newbie foolishness?
Neither really, though tending towards the latter :).
When you start up clisp, it drops you in the COMMON-LISP-USER package.
An implementation is free to dump whatever it wants in that package, and
in this case CLISP already has a function Y1 interned in that package.
Your definition of the Y1 accessor conficts with the existing definition
of Y1, and thus you get your error.
A way to debug this (and this is what i did) is to use APROPOS . i
started up clisp and typed (apropos 'y1) and noticed it found a function y1.
If you want to use y1 as your accessor, you can either SHADOW y1 in
CL-USER (not the best idea), or create your own package (much better).
hth,
drewc
>
> (ps: can the error reporing be coaxed into giving line numbers)
>
> The full error message is:
> NO-APPLICABLE-METHOD: When calling #<GENERIC-FUNCTION FIND-METHOD> with
> arguments (#<ADD-ON-SYSTEM-FUNCTION Y1> NIL (GAME-MAP) NIL), no method
> is applicable.
> [Condition of type METHOD-CALL-TYPE-ERROR]
>
> Restarts:
> 0: [ABORT] Abort handling SLIME request.
>
> Backtrace:
> 0: frame binding variables (~ = dynamically):
> | ~ SYSTEM::*FASOUTPUT-STREAM* <--> NIL
> 1: EVAL frame for form (DEFMETHOD Y1 ((CLOS::OBJECT GAME-MAP))
> (DECLARE (COMPILE)) (SLOT-VALUE CLOS::OBJECT 'Y1))
> 2: EVAL frame for form (LET NIL (EVAL-WHEN (COMPILE LOAD EVAL)
> (CLOS::ENSURE-CLASS 'GAME-MAP :DIRECT-SUPERCLASSES (LIST) :DIRECT-SLOTS
> (LIST (LIST :NAME 'Y1 :ACCESSORS '(Y1) :READERS '(Y1) :WRITERS
> '(#1=(SETF Y1)))))) (DEFMETHOD Y1 ((CLOS::OBJECT GAME-MAP)) (DECLARE
> (COMPILE)) (SLOT-VALUE CLOS::OBJECT 'Y1)) (DEFMETHOD #1#
> (CLOS::NEW-VALUE (CLOS::OBJECT GAME-MAP)) (DECLARE (COMPILE)) (SETF
> (SLOT-VALUE CLOS::OBJECT 'Y1) CLOS::NEW-VALUE)) (FIND-CLASS 'GAME-MAP))
> 3: EVAL frame for form (DEFCLASS GAME-MAP NIL ((Y1 :ACCESSOR Y1)))
> 4: EVAL frame for form (SWANK:LISTENER-EVAL "(defclass game-map ()
> ((y1 :accessor y1)))")
> 5: EVAL frame for form (SWANK:START-SERVER
> "c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/slime.2836")
>
--
Drew Crampsie
drewc at tech dot coop
"... the most advanced use of lisp in the field of bass lure sales"
-- Xach on #lisp
Geoffrey King <············@yahoo.com> writes:
> Thanks Drew, looks i was too ignorant to be foolish :)
I put this in my ~/.common.lisp which is loaded by all my ~/.clisprc,
~/.sbclrc, ~/openmcl-init.lisp, etc...
;; Clean the packages imported into COMMON-LISP-USER:
(MAPC (LAMBDA (USED) (UNUSE-PACKAGE USED "COMMON-LISP-USER"))
(REMOVE (FIND-PACKAGE "COMMON-LISP")
(COPY-SEQ (PACKAGE-USE-LIST "COMMON-LISP-USER"))))
An alternative is to never use CL-USER:
(defpackage :my-own-scratch-package (:use :cl))
(in-package :my-own-scratch-package)
--
__Pascal Bourguignon__ http://www.informatimago.com/
Cats meow out of angst
"Thumbs! If only we had thumbs!
We could break so much!"