Вопрос

#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)

If i compile this code and write (make suit) | (make jacket) | make (trousers) into the interpreter, the return is always #<procedure:swindleobj> but it should be sth like #<jacket size=40>.

Did I miss any requires or what am I doing wrong?

Это было полезно?

Решение

Your code is working for me:

#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
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top