blob: 132de358b33acd7f1ad934ec44468ec89f765375 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
(define-module (language python property)
#:use-module (oop pf-objects)
#:use-module (oop goops)
#:use-module (language python def)
#:use-module (language python exceptions)
#:use-module (language python persist)
#:export (property))
(cpit <property> (o (lambda (o get set del)
(slot-set! o 'get get)
(slot-set! o 'set set)
(slot-set! o 'del del))
(list
(slot-ref o 'get)
(slot-ref o 'set)
(slot-ref o 'del))))
(define-python-class property (<property>)
(define __init__
(lam (o (= getx None) (= setx None) (= delx None))
(slot-set! o 'get getx)
(slot-set! o 'set setx)
(slot-set! o 'del delx)
o))
(define __get__
(lambda (self obj class)
((slot-ref self 'get) obj)))
(define setter
(lambda (self f)
(slot-set! self 'set f)
self))
(define getter
(lambda (self f)
(slot-set! self 'get f)
self))
(define deleter
(lambda (self f)
(slot-set! self 'del f)
self))
(define fget (lambda (self) (slot-ref self 'get)))
(define fset (lambda (self) (slot-ref self 'set)))
(define fdel (lambda (self) (slot-ref self 'del))))
|