Ignore:
Timestamp:
08/21/20 16:46:26 (2 months ago)
Author:
Kon Lovett
Message:

dup slot storage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/5/coops-utils/trunk/coops-extras.scm

    r38400 r38863  
    1313(import (chicken base))
    1414(import (chicken type))
    15 (import (only (srfi 1) cons* remove))
     15(import (only (srfi 1) list-copy cons* remove))
    1616(import (only coops-introspection check-instance))
    1717(import coops)
     
    6262(: slot-values (coops-instance (list-of symbol) #!optional list -> list))
    6363;
    64 (define (slot-values x slots #!optional (base '()))
     64(define (slot-values obj slots #!optional (base '()))
    6565  (foldl
    6666    (lambda (ls slot)
    67       (if (slot-initialized? x slot)  ;per Jun 19, '17 email from Sandra Snan
    68         (plist-cons slot (slot-value x slot) ls)
     67      (if (slot-initialized? obj slot)  ;per Jun 19, '17 email from Sandra Snan
     68        (plist-cons slot (slot-value obj slot) ls)
    6969        ls ) )
    7070    base
     
    7474;
    7575(define (shadowed-initforms obj initforms #!optional (class (class-of obj)))
     76  ;shallow copy of the slots - share values but not storage
     77  ;FIXME 1-pass, dup storage & replace new values
    7678  (slot-values
    7779    obj
    78     (remove (cut initslot? <> initforms) (*class-slots class))
     80    (remove (cut initslot? <> initforms) (list-copy (*class-slots class)))
    7981    initforms) )
    8082
Note: See TracChangeset for help on using the changeset viewer.