Search code examples
schemeracketclos

make-operator returns swindleobject


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


Solution

  • 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