summaryrefslogtreecommitdiff
path: root/modules/oop
diff options
context:
space:
mode:
authorStefan Israelsson Tampe <stefan.itampe@gmail.com>2017-09-16 17:40:28 +0200
committerStefan Israelsson Tampe <stefan.itampe@gmail.com>2017-09-16 17:40:28 +0200
commit56d7b7b64eafd02f626826f9bf6e2dbe7c26d6ac (patch)
tree2dd27fe940962b28f8188a62d9a7ab6d4c74e984 /modules/oop
parentd82a3d264d43a4fe751d6d3629f64088b03f6ede (diff)
referencing python classes will now result in the full function with the self argument included
Diffstat (limited to 'modules/oop')
-rw-r--r--modules/oop/pf-objects.scm23
1 files changed, 22 insertions, 1 deletions
diff --git a/modules/oop/pf-objects.scm b/modules/oop/pf-objects.scm
index 323abfd..cb4d3c6 100644
--- a/modules/oop/pf-objects.scm
+++ b/modules/oop/pf-objects.scm
@@ -4,7 +4,7 @@
#:use-module (ice-9 match)
#:export (set ref make-pf <p> <py> <pf> <pyf>
call with copy fset fcall make-p put put!
- pcall pcall! get fset-x pyclass?
+ pcall pcall! get fset-x pyclass? refq
def-pf-class mk-pf-class make-pf-class
def-p-class mk-p-class make-p-class
def-pyf-class mk-pyf-class make-pyf-class
@@ -187,10 +187,31 @@ explicitly tell it to not update etc.
(unx mrefx-py mref-py)
(unx mrefx-py- mref-py-)
+(define-syntax-rule (unx mrefx- mref-)
+ (define-syntax-rule (mref- x key l)
+ (let ((xx x))
+ (let ((res (mrefx- xx key l)))
+ (if (and (not (struct? res))
+ (not (pyclass? res))
+ (procedure? res))
+ (lambda z
+ (apply res xx z))
+ res)))))
+
+(unx mrefx- mref-q)
+(unx mrefx mrefq)
+(unx mrefx-py mref-pyq)
+(unx mrefx-py- mref-py-q)
+
(define-method (ref (x <pf> ) key . l) (mref x key l))
(define-method (ref (x <p> ) key . l) (mref- x key l))
(define-method (ref (x <pyf>) key . l) (mref-py x key l))
(define-method (ref (x <py> ) key . l) (mref-py- x key l))
+
+(define-method (refq (x <pf> ) key . l) (mrefq x key l))
+(define-method (refq (x <p> ) key . l) (mref-q x key l))
+(define-method (refq (x <pyf>) key . l) (mref-pyq x key l))
+(define-method (refq (x <py> ) key . l) (mref-py-q x key l))
;; the reshape function that will create a fresh new pf object with less size
;; this is an expensive operation and will only be done when we now there is