Changeset 11759 in project


Ignore:
Timestamp:
08/25/08 20:46:05 (13 years ago)
Author:
sjamaan
Message:

Fix silly bug in initialization check, thanks to Alonso Andres for reporting it. Also fix another hygiene issue.

Location:
release/4/defstruct/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/defstruct/trunk/defstruct.scm

    r11634 r11759  
    7474                (old-make ,@no-init-fields ,@(map car init-fields)))))
    7575          (,%define ,set
    76             (,%let ((uninitialized (,%list)))
     76            (,%let ((,%uninitialized (,%list 'uninitialized)))
    7777             (lambda (obj ,%#!key ,@(map (lambda (f)
    78                                            (list f 'uninitialized))
     78                                           (list f %uninitialized))
    7979                                         field-names))
    8080               ,@(map
    8181                  (lambda (f)
    82                     `(,%if (,%not (,%eq? ,f uninitialized))
     82                    `(,%if (,%not (,%eq? ,f ,%uninitialized))
    8383                           (,(string->symbol (conc type-name "-" f "-set!"))
    8484                            obj ,f)))
     
    8686               obj)))
    8787          (,%define ,copy
    88             (,%let ((,%uninitialized (,%list)))
     88            (,%let ((,%uninitialized (,%list 'uninitialized)))
    8989             (lambda (old ,%#!key ,@(map (lambda (f)
    9090                                           (list f %uninitialized))
  • release/4/defstruct/trunk/tests/run.scm

    r11604 r11759  
    1 (load "../defstruct.scm")
    2 
    3 (import defstruct)
    4 
    5 (require-extension test)
     1(require-extension defstruct test)
    62
    73(defstruct empty)
     
    3329(test-group "updaters"
    3430  (let* ((c1 (make-complex field-1: 'foo))
    35          (c2 (complex-copy c1 field-1: 'bar))
     31         (c2 (complex-copy c1 field-1: '()))
    3632         (c3 (complex-copy c1 field-2: 'qux)))
    3733    (test 'foo (complex-field-1 c1))
    3834    (test 'two (complex-field-2 c1))
    39     (test 'bar (complex-field-1 c2))
     35    (test '() (complex-field-1 c2))
    4036    (test 'two (complex-field-2 c2))
    4137    (test 'foo (complex-field-1 c3))
     
    4844    (set-complex! c1 field-1: 'mutated)
    4945    (test 'mutated (complex-field-1 c1))
    50     (test 'bar (complex-field-1 c2))))
     46    (test '() (complex-field-1 c2))))
    5147
    5248(test-group "hygiene"
     
    5450  (define i1 (make-ini-capture))
    5551  (test 1 (ini-capture-uninitialized (ini-capture-copy i1)))
    56   (test 2 (ini-capture-uninitialized (ini-capture-copy i1 uninitialized: 2))))
     52  (test 2 (ini-capture-uninitialized (ini-capture-copy i1 uninitialized: 2)))
     53  (set-ini-capture! i1 uninitialized: 'uninitialized)
     54  (test 'uninitialized (ini-capture-uninitialized i1)))
Note: See TracChangeset for help on using the changeset viewer.