mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-18 17:50:29 +02:00
deprecate primitive properties
* libguile.h: * libguile/Makefile.am: * libguile/deprecated.h: * libguile/deprecated.c: * libguile/init.c: * libguile/properties.c: * libguile/properties.h: Deprecate the "primitive properties" interface. It was only used to implement object properties, and that is no longer the case. * module/ice-9/boot-9.scm (make-object-property): Reimplement just in terms of weak hash tables, and make threadsafe. * NEWS: * doc/ref/api-utility.texi: Update.
This commit is contained in:
parent
8269ba5b2c
commit
7948811252
10 changed files with 149 additions and 250 deletions
|
@ -587,10 +587,18 @@ VALUE."
|
|||
;; properties within the object itself.
|
||||
|
||||
(define (make-object-property)
|
||||
(let ((prop (primitive-make-property #f)))
|
||||
(define-syntax with-mutex
|
||||
(syntax-rules ()
|
||||
((_ lock exp)
|
||||
(dynamic-wind (lambda () (lock-mutex lock))
|
||||
(lambda () exp)
|
||||
(lambda () (unlock-mutex lock))))))
|
||||
(let ((prop (make-weak-key-hash-table))
|
||||
(lock (make-mutex)))
|
||||
(make-procedure-with-setter
|
||||
(lambda (obj) (primitive-property-ref prop obj))
|
||||
(lambda (obj val) (primitive-property-set! prop obj val)))))
|
||||
(lambda (obj) (with-mutex lock (hashq-ref prop obj)))
|
||||
(lambda (obj val) (with-mutex lock (hashq-set! prop obj val))))))
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue