summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/language/python/compile.scm4
-rw-r--r--modules/oop/pf-objects.scm23
2 files changed, 24 insertions, 3 deletions
diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm
index 597c71f..0919f1b 100644
--- a/modules/language/python/compile.scm
+++ b/modules/language/python/compile.scm
@@ -209,7 +209,7 @@
`(,(O 'set) ,(let lp ((v v) (new new))
(match new
((x . new)
- (lp `(,(O 'ref) ,v 'x) ',new))
+ (lp `(,(O 'refq) ,v 'x) ',new))
(() v)))
',(exp vs las)
,(if op
@@ -254,7 +254,7 @@
((x . trailer)
(match (pr x)
((#:identifier . _)
- (lp `(,(O 'ref) ,e ',(exp vs x) #f) trailer))
+ (lp `(,(O 'refq) ,e ',(exp vs x) #f) trailer))
((#:arglist args apply #f)
(if apply
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