0
#lang swindle
(require swindle/misc
         swindle/setf
     )


(defclass* jacket ()
  (size :initvalue 40 :accessor sj)
  :printer #t)

(defclass* trousers ()
  (size :initvalue 44 :accessor st)
  :printer #t)

(defclass* suit (jacket trousers)

如果我编译此代码并编写(制作西装)| (制作夹克)| 使(裤子)进入解释器,返回总是#<procedure:swindleobj>但它应该是 sth like #<jacket size=40>

我错过了任何要求还是我做错了什么?

4

1 回答 1

0

您的代码对我有用:

#lang swindle
(defclass* jacket () (size :initvalue 40 :accessor sj) :printer #t)
(define x (make jacket))

(displayln x)
=> #<jacket: size=40>

(displayln (slot-ref x 'size))
=> 40

(displayln (sj x))
=> 40
于 2014-01-11T00:18:59.970 回答