summaryrefslogtreecommitdiff
path: root/src/cli
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2006-09-25 17:54:37 +0000
committerRich Hickey <richhickey@gmail.com>2006-09-25 17:54:37 +0000
commit51c468f878a842bc6e469c32acbc58543448d081 (patch)
tree269d7766024da9e03a4f15e255c3c73ef8289b93 /src/cli
parent987dad567505261e0daf3dcbdd6363353cbe15a5 (diff)
renamed Namespace to Module
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/runtime/LispReader.cs2
-rw-r--r--src/cli/runtime/Module.cs (renamed from src/cli/runtime/Namespace.cs)16
-rw-r--r--src/cli/runtime/RT.cs2
-rw-r--r--src/cli/runtime/Symbol.cs2
-rw-r--r--src/cli/runtime/Var.cs6
5 files changed, 14 insertions, 14 deletions
diff --git a/src/cli/runtime/LispReader.cs b/src/cli/runtime/LispReader.cs
index 7aa22644..e1fcf36d 100644
--- a/src/cli/runtime/LispReader.cs
+++ b/src/cli/runtime/LispReader.cs
@@ -223,7 +223,7 @@ private static Object matchSymbol(String s) {
private static Object matchVar(String s) {
Match m = varPat.Match(s);
if(m.Success && m.Length == s.Length)
- return Namespace.intern(m.Groups[1].Value,m.Groups[2].Value);
+ return Module.intern(m.Groups[1].Value,m.Groups[2].Value);
return null;
}
diff --git a/src/cli/runtime/Namespace.cs b/src/cli/runtime/Module.cs
index aae5ffc1..e2c091fe 100644
--- a/src/cli/runtime/Namespace.cs
+++ b/src/cli/runtime/Module.cs
@@ -16,11 +16,11 @@ using System.Collections.Specialized;
namespace clojure.lang
{
-public class Namespace
+public class Module
{
/**
- * String->Namespace
+ * String->Module
*/
static public HybridDictionary table = new HybridDictionary();
@@ -31,24 +31,24 @@ public HybridDictionary vars = new HybridDictionary();
public String name;
-Namespace(String name)
+Module(String name)
{
this.name = name;
table.Add(name, this);
}
-static public Namespace find(String name)
+static public Module find(String name)
{
- return (Namespace) table[name];
+ return (Module) table[name];
}
-static public Namespace findOrCreate(String name)
+static public Module findOrCreate(String name)
{
lock(table)
{
- Namespace ns = find(name);
+ Module ns = find(name);
if(ns == null)
- ns = new Namespace(name);
+ table.Add(name,ns = new Module(name));
return ns;
}
}
diff --git a/src/cli/runtime/RT.cs b/src/cli/runtime/RT.cs
index 52c81ece..bb0c3886 100644
--- a/src/cli/runtime/RT.cs
+++ b/src/cli/runtime/RT.cs
@@ -21,7 +21,7 @@ public class RT
{
public static Symbol T = Symbol.intern("t");
- static public Var OUT = Namespace.intern("clojure", "^out");
+ static public Var OUT = Module.intern("clojure", "^out");
public static Object[] EMPTY_ARRAY = new Object[0];
diff --git a/src/cli/runtime/Symbol.cs b/src/cli/runtime/Symbol.cs
index 58bc30fe..c7dd6368 100644
--- a/src/cli/runtime/Symbol.cs
+++ b/src/cli/runtime/Symbol.cs
@@ -36,7 +36,7 @@ public static Symbol intern(String name) { lock(table) { Symbol sym = (Sym
else sym = new Symbol(name); if(table[name] != null) //defend against recursive static init
return (Symbol)table[name]; table.Add(name, sym); } return sym; } }
/**
- * Used by Namespace.intern()
+ * Used by Module.intern()
* @param name
* @param ns
*/
diff --git a/src/cli/runtime/Var.cs b/src/cli/runtime/Var.cs
index cb0327e7..626c4f48 100644
--- a/src/cli/runtime/Var.cs
+++ b/src/cli/runtime/Var.cs
@@ -15,11 +15,11 @@ namespace clojure.lang
{
public class Var : AFn
{
-public readonly Symbol sym; public Namespace ns; public Binding binding; volatile IPersistentMap threadBindings = PersistentArrayMap.EMPTY; volatile int tcount = 0; internal Var(Symbol sym, Namespace ns) { if(sym.GetType() != typeof(Symbol)) throw new ArgumentException("Only simple symbols can be vars"); this.ns = ns; this.sym = sym; } override public String ToString() { if(ns == null) return "#:" + sym; return ns.name + ":" + sym; } public Var bind(Object val) { if(binding == null)
+public readonly Symbol name; public Module module; public Binding binding; IPersistentMap threadBindings = PersistentArrayMap.EMPTY; int tcount = 0; internal Var(Symbol sym, Module ns) { if(sym.GetType() != typeof(Symbol)) throw new ArgumentException("Only simple symbols can be var names"); this.module = ns; this.name = sym; } override public String ToString() { if(module == null) return "#:" + name; return module.name + ":" + name; } public Var bind(Object val) { lock(this){ if(binding == null)
binding = new Binding(val); else binding.val = val;
- return this; } public Object getValue() {
- Binding binding = getBinding(); if(binding != null) return binding.val; throw new InvalidOperationException(this.ToString() + " is unbound."); } public Object setValue(Object val) {
+ return this; } } public Object getValue() {
+ Binding b = getBinding(); if(b != null) return b.val; throw new InvalidOperationException(this.ToString() + " is unbound."); } public Object setValue(Object val) {
Binding b = getThreadBinding(); if(b != null) return b.val = val; if(binding == null)
throw new InvalidOperationException(this.ToString() + " is unbound."); return binding.val = val; }