All pastes #130536 Raw Edit

Miscellany

public text v1 · immutable
#130536 ·published 2006-08-14 01:52 UTC
rendered paste body
;;; This was the original code, which only ever reached the else case.
;    (case owner-type
;      (((GNC-OWNER-CUSTOMER))
;       (set! type-str (N_ "Customer")))
;      (((GNC-OWNER-VENDOR))
;       (set! type-str (N_ "Vendor")))
;      (((GNC-OWNER-EMPLOYEE))
;       (set! type-str (N_ "Employee")))
;      (else (gnc:error "unkwown owner type:" owner-type)))


;; This is the result of debugging code being added.
    (let ((c (GNC-OWNER-CUSTOMER))
          (v (GNC-OWNER-VENDOR))
          (e (GNC-OWNER-EMPLOYEE)))
      
      (gnc:error "beg")
      (case owner-type
        ((c)
         (set! type-str (N_ "Customer")))
        ((v)
         (gnc:error "got here")
         (set! type-str (N_ "Vendor")))
        ((e)
         (set! type-str (N_ "Employee")))
        (else (gnc:error "unknown owner type: " owner-type ", not " c v e)))
      (if (eqv? c owner-type)
          (gnc:error "C!"))
      (if (eqv? v owner-type)
          (gnc:error "v==owner-type"))
      (if (eqv? e owner-type)
          (gnc:error "E!"))
      (if (eqv? v 4)
          (gnc:error "v==4"))
      (if (eqv? owner-type 4)
          (gnc:error "owner-type==4"))

      (gnc:error "end")
      )

;; And here's the output:

gnucash: [E] "beg"
gnucash: [E] "unknown owner type: "4", not "245
gnucash: [E] "v==owner-type"
gnucash: [E] "v==4"
gnucash: [E] "owner-type==4"
gnucash: [E] "end"

Notice how v == owner-type == 4, but the 'v' case is never reached!