late night hacks
This commit is contained in:
parent
0081d4fdfc
commit
14e716f05f
@ -59,10 +59,14 @@ def forge_module(name, fpath, forest):
|
||||
_add_native_methods(mod)
|
||||
|
||||
def shim():
|
||||
ns = globals()
|
||||
for tree in _hy_forest:
|
||||
tree.set_namespace(ns)
|
||||
|
||||
for tree in _hy_forest:
|
||||
tree.set_namespace(globals())
|
||||
tree()
|
||||
|
||||
mod.__dict__['_hy_self'] = mod
|
||||
eval(shim.__code__, mod.__dict__)
|
||||
|
||||
return mod
|
||||
|
@ -1,4 +1,5 @@
|
||||
#
|
||||
import sys
|
||||
|
||||
|
||||
def _define(obj):
|
||||
@ -30,8 +31,10 @@ def _import(obj):
|
||||
mods = args[0]
|
||||
|
||||
for module in mods:
|
||||
basename = module.split(".", 1)[0]
|
||||
mod = __import__(module)
|
||||
obj.namespace[module] = mod
|
||||
sys.modules[module] = mod
|
||||
ns[basename] = mod
|
||||
|
||||
|
||||
builtins = {
|
||||
|
@ -1,9 +1,9 @@
|
||||
; vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2 filetype=lisp
|
||||
|
||||
(import ["sys"])
|
||||
(import ["sys"
|
||||
"os.path"])
|
||||
|
||||
(def square (fn [x]
|
||||
(* x x)))
|
||||
|
||||
(print (square 2))
|
||||
(print sys.argv)
|
||||
(print os.path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user