summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-07-31 12:20:07 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-07-31 12:20:07 +0200
commit1be372285563189dba8f7ecf7b26a049f3728655 (patch)
treefe430c7070f886ab8b7fc1bd1a3e5f2067bf4038
parent604cc04c18af75e65b52a6b22b98d0f687d047c7 (diff)
Make keywords self-evaluate while interning, not while reading.
-rw-r--r--MLKPackage.m23
-rw-r--r--MLKReader.m10
2 files changed, 25 insertions, 8 deletions
diff --git a/MLKPackage.m b/MLKPackage.m
index 2757455..3153b74 100644
--- a/MLKPackage.m
+++ b/MLKPackage.m
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#import "MLKDynamicContext.h"
#import "MLKPackage.h"
#import "MLKSymbol.h"
#import "NSObject-MLKPrinting.h"
@@ -267,6 +268,17 @@ static NSMutableDictionary *packages = nil;
[_accessible_symbols setObject:symbol forKey:name];
[_present_symbols addObject:symbol];
+
+ if ([_name isEqual:@"KEYWORD"])
+ {
+ // Make keyword symbols self-evaluate.
+ [[MLKDynamicContext globalContext] addValue:symbol forSymbol:symbol];
+
+ // Make them external as well.
+ [self export:symbol];
+
+ // FIXME: Should finally make them constant, see CLHS 10.2, Type KEYWORD.
+ }
}
-(void) inherit:(MLKSymbol *)symbol
@@ -290,6 +302,17 @@ static NSMutableDictionary *packages = nil;
[self descriptionForLisp]];
[_accessible_symbols setObject:symbol forKey:name];
+
+ if ([_name isEqual:@"KEYWORD"])
+ {
+ // Make keyword symbols self-evaluate.
+ [[MLKDynamicContext globalContext] addValue:symbol forSymbol:symbol];
+
+ // Make them external as well.
+ [self export:symbol];
+
+ // FIXME: Should finally make them constant, see CLHS 10.2, Type KEYWORD.
+ }
}
-(void) uninherit:(MLKSymbol *)symbol
diff --git a/MLKReader.m b/MLKReader.m
index a6f11c1..abd8a43 100644
--- a/MLKReader.m
+++ b/MLKReader.m
@@ -522,20 +522,14 @@ readingUninternedSymbol:(BOOL)readingUninternedSymbol
else
symbol = [MLKSymbol symbolWithName:symbolName package:nil];
- if (packageMarker == 0)
- {
- // Make keyword symbols self-evaluate.
- [[MLKDynamicContext globalContext] addValue:symbol forSymbol:symbol];
- }
-
return symbol;
}
}
+(id) readFromString:(NSString *)string
{
- return [self readFromStream:[[MLKStringInputStream alloc]
- initWithString:string]
+ return [self readFromStream:AUTORELEASE([[MLKStringInputStream alloc]
+ initWithString:string])
eofError:YES
eofValue:nil
recursive:NO