From 164e403a974165af103fa072d0f14e2e256153be Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Tue, 17 Jun 2008 21:20:42 +0200 Subject: MLKDynamicContext#+initialize: Fix various sources of crashes. --- MLKSymbol.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'MLKSymbol.h') diff --git a/MLKSymbol.h b/MLKSymbol.h index 82526d2..3aa2a1e 100644 --- a/MLKSymbol.h +++ b/MLKSymbol.h @@ -18,13 +18,16 @@ #import "MLKLispValue.h" +#import + @class MLKPackage; -@interface MLKSymbol : MLKLispValue +@interface MLKSymbol : MLKLispValue { NSString *name; MLKPackage *homePackage; + MLKSymbol *real_identity; } -(MLKSymbol *) initWithName:(id)aName package:(id)aPackage; @@ -35,5 +38,20 @@ -(NSString *)descriptionForLisp; +// PLEASE DO NOT USE THIS. +// +// Symbols should never be copied. MLKSymbol needs to implement +// NSCopying as well as suitable version of isEqual: so that symbols can +// be used as dictionary keys. Don't call -copy on a symbol manually, +// please. +-(id) copyWithZone:(NSZone *)zone; + +// PLEASE DO NOT USE THIS. +// +// It uses an ugly hack for determining symbol identity in the face of +// copying. (The hack is called real_identity and it's an ivar of this +// class.) See the comment above copyWithZone: for why it even exists. +-(BOOL) isEqual:(id)object; + -(void) dealloc; @end -- cgit v1.2.3