Hi list,
(make-package :vhost :use '(:common-lisp)) ;;; => #<PACKAGE "VHOST">
(in-package :vhost)
(defclass vhost (tbnl:acceptor) ((tbnl::name :initform (error "Please give this VHOST a meaningful name.")))) ;;; => #<STANDARD-CLASS VHOST>
(describe 'vhost) ;;; => VHOST::VHOST ;;; [symbol] ;;; ;;; VHOST names the standard-class #<STANDARD-CLASS VHOST>: ;;; Class precedence-list: VHOST, HUNCHENTOOT:ACCEPTOR, STANDARD-OBJECT, ;;; SB-PCL::SLOT-OBJECT, T ;;; Direct superclasses: HUNCHENTOOT:ACCEPTOR ;;; No subclasses. ;;; Direct slots: ;;; HUNCHENTOOT::NAME ;;; Initform: (ERROR "A virtual host must have a meaningful name.")
(defvar *vhost1* (make-instance 'vhost)) ;;; => *VHOST1* <--- WHY NO ERROR ???
(describe *vhost1*) ;;; => #<VHOST (host *, port 80)> ;;; [standard-object] ;;; ;;; Slots with :INSTANCE allocation: ;;; PORT = 80 ;;; ADDRESS = NIL ;;; NAME = #:G1150 <--- this is what I want to prevent ;;; [...]
Practical Common Lisp - page 214:
"... if multiple classes specify an initform the new class uses the one from the most specific class. This allows a subclass to specify a different default value than the one it would otherwise inherit."
What am I doing wrong here?
Sebastian