I often make the silly mistake of passing a symbol as argument to Namespace class>>#current:. I wouldn't normally want kernel methods to do explicit checks for errors like this, except that backtraces that mention classes outside the current namespace-and-supers chain can cause infinite recursion in the backtrace printing.
Try it out: st> Namespace current addSubspace: #Test! st> Namespace current: #Test! st> (#(1 2 3) detect: [:each | each = 4]) qqq! Object: Collection error: Invalid argument nil: object not found Smalltalk.Collection class(Smalltalk.Object)>>#primError: Object: #SystemExceptions error: did not understand #between:and: Smalltalk.Symbol(Smalltalk.Object)>>#primError: Smalltalk.MessageNotUnderstood(Smalltalk.Exception)>>#defaultAction optimized [] in Smalltalk.Exception class>>#coreException Smalltalk.MessageNotUnderstood(Smalltalk.Signal)>>#activateHandler: Smalltalk.MessageNotUnderstood(Smalltalk.Exception)>>#signal Smalltalk.Symbol(Smalltalk.Object)>>#doesNotUnderstand: Smalltalk.Symbol(Smalltalk.SequenceableCollection)>>#at:ifAbsent: Smalltalk.Namespace>>#printOn:in: <repeat last 9 lines ad infinitum> The primitive for Namespace class>>#current: appears to ignore its argument if it is not a Dictionary or Class. Perhaps the Smalltalk code that follows it should do the same, or signal an error of some kind, if aNamespaceOrClass is not in fact a BindingDictionary (or Dictionary) or Class? Or maybe I should just write an extra check for isKindOf: Array in my local copy. :) -- Stephen Compall http://scompall.nocandysw.com/blog _______________________________________________ help-smalltalk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-smalltalk
