[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Readers, methods, and congruent lambda lists
- To: commonloops.parc@xerox.com
- Subject: Readers, methods, and congruent lambda lists
- From: konstan@elmer-fudd.berkeley.EDU (Joe Konstan)
- Date: Wed, 17 Oct 1990 15:06:01 PDT
- Illegal-object: Syntax error in Message-Id: value found on alpha.xerox.com: Message-Id: <9010172206.AA04218@elmer-fudd.berkeley.edu.> ^-illegal subdomain in domain
I recall this being discussed before on this list, but am afraid I don't
remember the outcome. Here is the problem:
I would like to define methods that take keywords and that have the same name
as slot-readers: For instance:
(defclass foo ()
((a-slot :reader width)))
(defmethod width ((Self string) &key (font nil) &allow-other-keys
(get-string-width self font))
This results in an error based on incongurent lambda lists:
Error: the method and generic function differ in whether they accept
rest or keyword arguments.
I've tried different forms of defgeneric, and still seem unable to resolve this.
I see three possibilities:
1. There is a way to handle this that I an unaware of (i.e. telling the reader
to allow other keys).
2. I should abandon the :reader definition and instead define a reader method
by hand using slot-value (do I lose the added efficiency a reader method
can have?).
3. I should give up on the idea of keeping the names the same and rename
one or the other.
Ideas?
Joe Konstan
konstan@postgres.Berkeley.edu