(clos) additional properties to slot definition

Discussion of Common Lisp
Post Reply
baleog
Posts: 1
Joined: Mon Feb 24, 2014 4:23 am

(clos) additional properties to slot definition

Post by baleog » Mon Feb 24, 2014 4:46 am

http://mop.lisp.se/concepts.html says:
An implementation is free to add additional properties to the canonicalized slot specification provided these are not symbols accessible in the common-lisp-user package, or exported by any package defined in the ANSI Common Lisp standard.
with example:

Code: Select all

(defclass sst (plane)
     ((mach mag-step 2
            locator sst-mach
            locator mach-location
            :reader mach-speed
            :reader mach))
  (:metaclass faster-class)
  (another-option foo bar))
But when i try:

Code: Select all

(defclass a () ((x my-option 123)))
sbcl compile it with error:
Invalid initialization argument:
MY-OPTION
in call for class #<STANDARD-CLASS
SB-MOP:STANDARD-DIRECT-SLOT-DEFINITION>.
[Condition of type SB-PCL::INITARG-ERROR]
So the question. How can I add additional properties to the slot definition?

pjstirling
Posts: 166
Joined: Sun Nov 28, 2010 4:21 pm

Re: (clos) additional properties to slot definition

Post by pjstirling » Mon Mar 03, 2014 8:51 am

I'm no clos expert, but wouldn't you need to use a different metaclass?

Post Reply