summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-03-20 09:55:20 +0100
committerStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-03-20 09:55:20 +0100
commit54f0ed4762f8aec49f894901a490a0821f176de8 (patch)
tree4a1ec45e503b569a84052b8ed0923ea1b7534703 /modules
parentd71244f5cb87a4a61a6b341e4838a38e50142815 (diff)
modules now works as expected
Diffstat (limited to 'modules')
-rw-r--r--modules/language/python/compile.scm28
-rw-r--r--modules/language/python/module.scm28
-rw-r--r--modules/language/python/module/python.scm2
3 files changed, 31 insertions, 27 deletions
diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm
index 3d9fc95..b287e4b 100644
--- a/modules/language/python/compile.scm
+++ b/modules/language/python/compile.scm
@@ -822,6 +822,17 @@
((_ (#:from (() . nm) . #f))
`(use-modules (language python module ,@(map (lambda (nm) (exp vs nm))
nm))))
+ ((_ (#:from (() . nm) . l))
+ `(use-modules ((language python module ,@(map (lambda (nm) (exp vs nm))
+ nm))
+ #:select ,(map (lambda (x)
+ (match x
+ ((a . #f)
+ (exp vs a))
+ ((a . b)
+ (cons (exp vs a) (exp vs b)))))
+ l))))
+
((_ (#:name ((ids ...) . as)) ...)
(pk x)
@@ -836,20 +847,21 @@
((#:test (#:power #f ,as ())))
(#:assign
((#:verb
- ((@ (language python module) Module)
- ',(reverse (append '(language python module) path))
- ',(reverse path)))))))
-
+ ((@ (language python module) import)
+ ((@ (language python module) Module)
+ ',(reverse (append '(language python module) path))
+ ',(reverse path))
+ ,(exp vs as)))))))
(exp
vs
`(#:expr-stmt
((#:test (#:power #f ,(car ids) ())))
(#:assign
((#:verb
- (((@ (language python module) import)
- ((@ (language python module) Module)
- ',(append '(language python module) path))
- ,(exp vs (car ids))))))))))))
+ ((@ (language python module) import)
+ ((@ (language python module) Module)
+ ',(append '(language python module) path))
+ ,(exp vs (car ids)))))))))))
ids as))))
(#:for
diff --git a/modules/language/python/module.scm b/modules/language/python/module.scm
index 55120e0..5da5992 100644
--- a/modules/language/python/module.scm
+++ b/modules/language/python/module.scm
@@ -57,7 +57,6 @@
(define __init__
(case-lambda
((self pre l nm)
- (pk 2 l)
(match l
((name)
(set self '_path (reverse (cons name pre)))
@@ -72,7 +71,6 @@
(_cont self #f l #f nm))
((self l)
- (pk 1)
(if (pair? l)
(if (and (> (length l) 3)
(equal? (list (list-ref l 0)
@@ -105,7 +103,7 @@
(list-ref l 1)
(list-ref l 2))
'(language python module)))
- (__uppdate__ self (reverse '(language python module))
+ (__update__ self (reverse '(language python module))
(cdddr l) '()))
(__update__ self
(map string->symbol
@@ -113,19 +111,15 @@
(define _make
(lambda (self l nm)
- (pk 'make)
(rawset self '_private #f)
(if (not (rawref self '_module))
(begin
- (pk 'a)
(set self '__dict__ self)
(set self '__name__ (string-join
(map symbol->string (reverse nm)) "."))
- (pk 'b)
(let ((_module (resolve-module (reverse l))))
(set self '_export (module-public-interface _module))
(set self '_module _module)
- (pk 'c)
(hash-set! _modules l self))))))
(define __getattribute__
@@ -154,7 +148,7 @@
(if (module-defined? m k)
(module-set! m k v)
(module-define! m k v)))
- (lambda x (pk 'fail x)))
+ (lambda x (fail x)))
(fail))))))
(define __delattr__
@@ -194,15 +188,14 @@
(define-syntax import
(lambda (x)
- (pk (syntax->datum x))
(syntax-case x ()
((_ (a ...) var)
- #`(import-f #,(case (pk (syntax-local-binding #'var))
+ #`(import-f #,(case (syntax-local-binding #'var)
((lexical)
#'var)
((global)
- #'(if (pk (module-defined? (current-module)
- (syntax->datum #'var)))
+ #'(if (module-defined? (current-module)
+ (syntax->datum #'var))
var
#f))
(else
@@ -210,9 +203,8 @@
(define (m? x) ((@ (language python module python) isinstance) x Module))
(define (import-f x f . l)
- (pk 'import-f f x)
- (pk (if x
- (if (m? x)
- (apply (rawref x '__update__) l)
- (apply f l))
- (apply (pk f) l))))
+ (if x
+ (if (m? x)
+ (begin (apply (rawref x '__update__) l) x)
+ (apply f l))
+ (apply f l)))
diff --git a/modules/language/python/module/python.scm b/modules/language/python/module/python.scm
index 093d03e..cfa0f3e 100644
--- a/modules/language/python/module/python.scm
+++ b/modules/language/python/module/python.scm
@@ -127,7 +127,7 @@
(or
(isinstance o (car cl))
(isinstance o (cdr cl)))
- (is-a? (ref (ref o '__class__) '__goops__) cl))))
+ (is-a? o (ref cl '__goops__)))))
(define iter
(case-lambda