Summary
typed-records: defstruct breaks with default values
Metadata
- Id: b20ceeb881d08763cd9e9943b6df24734e50dd8b
- Trac id: 943
- Type: defect
- Reporter: megane
- Owner: felix
- Cc:
- Status: closed
- Component: extensions
- Estimated difficulty:
- Resolution: fixed
- Priority: major
- Milestone: someday
- Version: 4.8.x
- Changetime: 2012-10-31 12:43:47 UTC
- Created: 2012-10-29 21:13:50 UTC
- Keywords:
Description
The expected output is shown in case 3. In this case the slot for 'a' is defined as `(a : fixnum)`.
If the default is given the slot and accessor indices are reversed, and with `-specialized` just the slot indices are reversed.
(use typed-records)
(defstruct bar
((a 100) : fixnum)
(b : fixnum))
(define (create-bar a)
(let* [(b (make-bar a: a b: 42))]
(print "(bar-a b) " (bar-a b))
(print "(bar-b b) " (bar-b b))
(print "(##sys#slot b 1) " (##sys#slot b 1))
(print "(##sys#slot b 2) " (##sys#slot b 2))
b))
(create-bar 1)
;; 1. no -specialize
;; (bar-a b) 1
;; (bar-b b) 42
;; (##sys#slot b 1) 42
;; (##sys#slot b 2) 1
;; 2. with -specialize
;; (bar-a b) 42
;; (bar-b b) 1
;; (##sys#slot b 1) 42
;; (##sys#slot b 2) 1
;; 3. without the default `100' for slot `a'
;; (bar-a b) 1
;; (bar-b b) 42
;; (##sys#slot b 1) 1
;; (##sys#slot b 2) 42
Changes and comments
[2012-10-30 11:01:06 UTC] felix changed status from new to assigned
[2012-10-30 11:01:06 UTC] felix set owner to felix
[2012-10-30 13:30:34 UTC] felix wrote:
Please try typed-records 0.4.
[2012-10-31 12:43:47 UTC] megane changed status from assigned to closed
[2012-10-31 12:43:47 UTC] megane set resolution to fixed
[2012-10-31 12:43:47 UTC] megane wrote:
It works now. Thank you.