A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.lispworks.com/documentation/lw71/LW/html/lw-249.htm below:

class-extra-initargs

Notes

class-extra-initargs is useful only in complex cases. In most cases other ways of extending the set of valid initargs are simpler and clearer, such as the :extra-initargs class option, described in defclass.

Example

In this session an illegal initarg :my-keyword is passed, causing make-instance to signal an error.

Then :my-keyword is added as an extra initarg, after which make-instance accepts it.

CL-USER 38 > (defclass my-class () ((a :initform nil)))
#<STANDARD-CLASS MY-CLASS 113AAA2F>
 
CL-USER 39 > (make-instance 'my-class :my-keyword 8)
 
Error: MAKE-INSTANCE is called with unknown keyword :MY-KEYWORD among the  arguments (MY-CLASS :MY-KEYWORD 8) {no keywords allowed}
  1 (continue) Ignore the keyword :MY-KEYWORD
  2 (abort) Return to level 0.
  3 Return to top loop level 0.
 
Type :b for backtrace, :c <option number> to proceed,  or :? for other options
 
CL-USER 40 : 1 > :a
 
CL-USER 41 > (defmethod clos:class-extra-initargs
	                ((x my-class))
               '(:my-keyword))
#<STANDARD-METHOD CLOS:CLASS-EXTRA-INITARGS (MY-CLASS) 1137C763>
 
CL-USER 42 > (make-instance 'my-class :my-keyword 8)
#<MY-CLASS 11368963>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4