[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Namespace current: aSymbol

From: Stephen Compall
Subject: [Help-smalltalk] Namespace current: aSymbol
Date: Thu, 07 Sep 2006 17:06:41 -0500
User-agent: Thunderbird (Macintosh/20060719)

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:
optimized [] in Smalltalk.Exception class>>#coreException
<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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]