|
|
@ -1,8 +1,5 @@
|
|
|
|
#lang racket/base
|
|
|
|
#lang racket/base
|
|
|
|
(require (for-syntax racket/base racket/syntax)
|
|
|
|
(require racket/class (for-syntax racket/base racket/syntax) racket/dict)
|
|
|
|
racket/class
|
|
|
|
|
|
|
|
racket/promise
|
|
|
|
|
|
|
|
racket/dict)
|
|
|
|
|
|
|
|
(provide (all-defined-out))
|
|
|
|
(provide (all-defined-out))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -47,7 +44,7 @@
|
|
|
|
(define ·-helper
|
|
|
|
(define ·-helper
|
|
|
|
(procedure-rename
|
|
|
|
(procedure-rename
|
|
|
|
(λ (x . refs)
|
|
|
|
(λ (x . refs)
|
|
|
|
(for/fold ([x (force x)])
|
|
|
|
(for/fold ([x x])
|
|
|
|
([ref (in-list refs)]
|
|
|
|
([ref (in-list refs)]
|
|
|
|
#:break (not x))
|
|
|
|
#:break (not x))
|
|
|
|
(cond
|
|
|
|
(cond
|
|
|
@ -58,7 +55,7 @@
|
|
|
|
[(dict? x) (dict-ref x ref #f)]
|
|
|
|
[(dict? x) (dict-ref x ref #f)]
|
|
|
|
[(object? x) (cond
|
|
|
|
[(object? x) (cond
|
|
|
|
[(memq ref (field-names x)) (dynamic-get-field ref x)]
|
|
|
|
[(memq ref (field-names x)) (dynamic-get-field ref x)]
|
|
|
|
[else #f])]
|
|
|
|
[else #f])]
|
|
|
|
[else (raise-argument-error '· "object or dict" x)]))) '·))
|
|
|
|
[else (raise-argument-error '· "object or dict" x)]))) '·))
|
|
|
|
|
|
|
|
|
|
|
|
(define-syntax-rule (· X REF ...) (·-helper X 'REF ...))
|
|
|
|
(define-syntax-rule (· X REF ...) (·-helper X 'REF ...))
|
|
|
@ -86,7 +83,7 @@
|
|
|
|
(field [foo 'field])
|
|
|
|
(field [foo 'field])
|
|
|
|
(define/public (bar) 'method)
|
|
|
|
(define/public (bar) 'method)
|
|
|
|
(define/public (zam) (hasheq 'zoom 'hash))))
|
|
|
|
(define/public (zam) (hasheq 'zoom 'hash))))
|
|
|
|
(define h (delay (hasheq 'bam (new C) 'foo 'hashlet)))
|
|
|
|
(define h (hasheq 'bam (new C) 'foo 'hashlet))
|
|
|
|
(define o (new C))
|
|
|
|
(define o (new C))
|
|
|
|
(check-equal? (· o foo) 'field)
|
|
|
|
(check-equal? (· o foo) 'field)
|
|
|
|
(check-equal? (· o bar) 'method)
|
|
|
|
(check-equal? (· o bar) 'method)
|
|
|
|