[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] AbstractNamespace >> #removeSubspace:
From: |
Stephen Compall |
Subject: |
[Help-smalltalk] AbstractNamespace >> #removeSubspace: |
Date: |
Fri, 09 Feb 2007 19:42:02 -0600 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.2pre) Gecko/20070111 SeaMonkey/1.1 |
I have use for a method that can remove namespaces similarly to their
addition with addSubspace:, so I hijacked removeSubspace: (which doesn't
seem to be used at all currently), changed its category, and gave it
similar semantics to addSubspace:.
See attached, also at
address@hidden/smalltalk--backstage--2.2--patch-8,
which is against smalltalk--devo--2.2--patch-259.
--
Stephen Compall
http://scompall.nocandysw.com/blog
2007-02-09 Stephen Compall <address@hidden>
* kernel/AbstNamespc.st: Make removeSubspace: public, change its
argument to be a symbol rather than a namespace, and don't make it
a subspace of Smalltalk.
--- orig/kernel/AbstNamespc.st
+++ mod/kernel/AbstNamespc.st
@@ -321,6 +321,17 @@
space notNil ] whileTrue
!
+removeSubspace: aSymbol
+ "Remove my subspace named aSymbol from the hierarchy."
+ | spaceName |
+ spaceName := aSymbol asGlobalKey. "as with primNew:name:"
+ self subspaces remove: (self hereAt: spaceName)
+ ifAbsent: [SystemExceptions.InvalidValue
+ signalOn: aSymbol
+ reason: 'aSymbol must name a subspace'].
+ ^self removeKey: spaceName
+!
+
selectSubspaces: aBlock
"Return a Set of subspaces of the receiver satisfying aBlock."
| aSet |
@@ -489,11 +500,6 @@
setSubspaces: newSubspaces
subspaces := newSubspaces
-!
-
-removeSubspace: aNamespace
- self subspaces remove: aNamespace.
- aNamespace setSuperspace: nil
! !
- [Help-smalltalk] AbstractNamespace >> #removeSubspace:,
Stephen Compall <=