Changeset 38893 in project


Ignore:
Timestamp:
08/28/20 17:49:45 (4 weeks ago)
Author:
felix winkelmann
Message:

coops 1.3: added slot-exists?

Location:
release/5/coops
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/5/coops/tags/1.3/coops-module.scm

    r37653 r38893  
    1111(module coops (slot-value
    1212               slot-ref                 ; OBSOLETE
     13               slot-exists?
    1314               slot-initialized?
    1415               <standard-class>
  • release/5/coops/tags/1.3/coops.scm

    r37857 r38893  
    155155        (not (eq? (##sys#slot (coops-instance-slots obj) i) uninitialized))
    156156        (error "slot not found" slotname obj))))
     157
     158(define (slot-exists? obj slotname)
     159  (and (slot-lookup obj slotname 'slot-initialized?) #t))
    157160
    158161(define (class-of o)
  • release/5/coops/tags/1.3/tests/run.scm

    r35591 r38893  
    2929(test 89 (slot-value i1 'x))
    3030(test 100 (slot-value i2 'x))
     31(test #t (slot-exists? i1 'x))
     32(test #f (slot-exists? i1 'z))
    3133
    3234;; undefined generic
  • release/5/coops/trunk/coops-module.scm

    r37653 r38893  
    1111(module coops (slot-value
    1212               slot-ref                 ; OBSOLETE
     13               slot-exists?
    1314               slot-initialized?
    1415               <standard-class>
  • release/5/coops/trunk/coops.scm

    r37857 r38893  
    155155        (not (eq? (##sys#slot (coops-instance-slots obj) i) uninitialized))
    156156        (error "slot not found" slotname obj))))
     157
     158(define (slot-exists? obj slotname)
     159  (and (slot-lookup obj slotname 'slot-initialized?) #t))
    157160
    158161(define (class-of o)
  • release/5/coops/trunk/tests/run.scm

    r35591 r38893  
    2929(test 89 (slot-value i1 'x))
    3030(test 100 (slot-value i2 'x))
     31(test #t (slot-exists? i1 'x))
     32(test #f (slot-exists? i1 'z))
    3133
    3234;; undefined generic
Note: See TracChangeset for help on using the changeset viewer.