renaming getNamespace to getExports; will have separate getNamespace function that works more like Racket's

This commit is contained in:
Danny Yoo 2013-03-27 15:22:24 -06:00
parent 6a9dce8d57
commit 577562944a
8 changed files with 15 additions and 15 deletions

View File

@ -2,7 +2,7 @@
// JavaScript land... // JavaScript land...
var colorNamespace = MACHINE.modules['whalesong/image/private/color.rkt'].getNamespace(); var colorNamespace = MACHINE.modules['whalesong/image/private/color.rkt'].getExports();
var colorStruct = colorNamespace.get('struct:color'); var colorStruct = colorNamespace.get('struct:color');
var makeColor = function(r,g,b,a) { return colorStruct.constructor([r,g,b,a]); }; var makeColor = function(r,g,b,a) { return colorStruct.constructor([r,g,b,a]); };

View File

@ -95,7 +95,7 @@
(format "M.primitives[~s]._i(M)" (symbol->string (ApplyPrimitiveProcedure-name op)))] (format "M.primitives[~s]._i(M)" (symbol->string (ApplyPrimitiveProcedure-name op)))]
[(ModuleVariable? op) [(ModuleVariable? op)
(format "M.modules[~s].getNamespace().get(~s)" (format "M.modules[~s].getExports().get(~s)"
(symbol->string (symbol->string
(ModuleLocator-name (ModuleLocator-name
(ModuleVariable-module-name op))) (ModuleVariable-module-name op)))
@ -108,4 +108,4 @@
(format "(M.globals[~s]!==void(0)?M.globals[~s]:M.params.currentNamespace.get(~s))" (format "(M.globals[~s]!==void(0)?M.globals[~s]:M.params.currentNamespace.get(~s))"
(symbol->string (GlobalsReference-name op)) (symbol->string (GlobalsReference-name op))
(symbol->string (GlobalsReference-name op)) (symbol->string (GlobalsReference-name op))
(symbol->string (GlobalsReference-name op)))])) (symbol->string (GlobalsReference-name op)))]))

View File

@ -95,7 +95,7 @@
rhs))] rhs))]
[(ModuleVariable? target) [(ModuleVariable? target)
(lambda: ([rhs : String]) (lambda: ([rhs : String])
(format "M.modules[~s].getNamespace().set(~s,~s);" (format "M.modules[~s].getExports().set(~s,~s);"
(symbol->string (ModuleLocator-name (ModuleVariable-module-name target))) (symbol->string (ModuleLocator-name (ModuleVariable-module-name target)))
(symbol->string (ModuleVariable-name target)) (symbol->string (ModuleVariable-name target))
rhs))] rhs))]
@ -497,7 +497,7 @@
(: assemble-module-variable-ref (ModuleVariable -> String)) (: assemble-module-variable-ref (ModuleVariable -> String))
(define (assemble-module-variable-ref var) (define (assemble-module-variable-ref var)
(format "M.modules[~s].getNamespace().get(~s)" (format "M.modules[~s].getExports().get(~s)"
(symbol->string (ModuleLocator-name (ModuleVariable-module-name var))) (symbol->string (ModuleLocator-name (ModuleVariable-module-name var)))
(symbol->string (ModuleVariable-name var)))) (symbol->string (ModuleVariable-name var))))

View File

@ -209,9 +209,9 @@
(symbol->string (ModuleProvide-external-name a-provide)) (symbol->string (ModuleProvide-external-name a-provide))
(symbol->string (ModuleProvide-internal-name a-provide))))] (symbol->string (ModuleProvide-internal-name a-provide))))]
[else [else
(format "ns.set(~s, M.modules[~s].getNamespace().get(~s));" (format "ns.set(~s, M.modules[~s].getExports().get(~s));"
(symbol->string (ModuleProvide-external-name a-provide)) (symbol->string (ModuleProvide-external-name a-provide))
(symbol->string (ModuleLocator-name (ModuleProvide-source a-provide))) (symbol->string (ModuleLocator-name (ModuleProvide-source a-provide)))
(symbol->string (ModuleProvide-internal-name a-provide)))])) (symbol->string (ModuleProvide-internal-name a-provide)))]))
"") "")
(format "}(M.modules[~s],M.modules[~s].getNamespace(),M.modules[~s].getExternalNamespace(),M.modules[~s].prefix));" modname modname modname modname))])) (format "}(M.modules[~s],M.modules[~s].getExports(),M.modules[~s].getExternalNamespace(),M.modules[~s].prefix));" modname modname modname modname))]))

View File

@ -217,7 +217,7 @@
(format " (format "
if(--M.cbt<0) { throw arguments.callee; } if(--M.cbt<0) { throw arguments.callee; }
var modrec = M.modules[~s]; var modrec = M.modules[~s];
var ns = modrec.getNamespace(); var ns = modrec.getExports();
var extNs = modrec.getExternalNamespace(); var extNs = modrec.getExternalNamespace();
~a ~a
var exports = {}; var exports = {};

View File

@ -34,7 +34,7 @@
this.label = label; this.label = label;
this.isInvoked = false; this.isInvoked = false;
this.prefix = false; this.prefix = false;
this.namespace = new Namespace(this); this.exports = new Namespace(this);
this.externalNamespace = new Namespace(this); this.externalNamespace = new Namespace(this);
// JavaScript-implemented code will assign privateExports // JavaScript-implemented code will assign privateExports
@ -55,8 +55,8 @@
// Returns access to the names provided in the module. // Returns access to the names provided in the module.
// Note that the names are the names internal to the module. // Note that the names are the names internal to the module.
ModuleRecord.prototype.getNamespace = function () { ModuleRecord.prototype.getExports = function () {
return this.namespace; return this.exports;
}; };
// Returns access to the names defined with their external names. // Returns access to the names defined with their external names.

View File

@ -345,14 +345,14 @@
// Try to get the continuation mark key used for procedure application tracing. // Try to get the continuation mark key used for procedure application tracing.
var getTracedAppKey = function(MACHINE) { var getTracedAppKey = function(MACHINE) {
if (MACHINE.modules['whalesong/lang/private/traced-app.rkt']) { if (MACHINE.modules['whalesong/lang/private/traced-app.rkt']) {
return MACHINE.modules['whalesong/lang/private/traced-app.rkt'].getNamespace().get('traced-app-key') || 'traced-app-key'; return MACHINE.modules['whalesong/lang/private/traced-app.rkt'].getExports().get('traced-app-key') || 'traced-app-key';
} }
return void(0); return void(0);
}; };
var getTracedCalleeKey = function(MACHINE) { var getTracedCalleeKey = function(MACHINE) {
if (MACHINE.modules['whalesong/lang/private/traced-app.rkt']) { if (MACHINE.modules['whalesong/lang/private/traced-app.rkt']) {
return MACHINE.modules['whalesong/lang/private/traced-app.rkt'].getNamespace().get('traced-callee-key') || 'traced-callee-key'; return MACHINE.modules['whalesong/lang/private/traced-app.rkt'].getExports().get('traced-callee-key') || 'traced-callee-key';
} }
return void(0); return void(0);
}; };
@ -839,7 +839,7 @@
var i; var i;
machine = machine || runtime.currentMachine; machine = machine || runtime.currentMachine;
for (i = 0; i < machine.mainModules.length; i++) { for (i = 0; i < machine.mainModules.length; i++) {
var ns = machine.mainModules[i].getNamespace(); var ns = machine.mainModules[i].getExports();
if(ns.hasKey(name)) { if(ns.hasKey(name)) {
return ns.get(name); return ns.get(name);
} }

View File

@ -73,7 +73,7 @@ jQuery(document).ready(function() {
semanticsModule.invoke( semanticsModule.invoke(
M, M,
function() { function() {
M.params.currentNamespace = semanticsModule.getNamespace(); M.params.currentNamespace = semanticsModule.getExports();
afterLanguageInitialization(); afterLanguageInitialization();
}, },
function(M, err) { function(M, err) {