I was playing with creating temporary classes for testing in a separate
SystemDictionary, so I don't have to worry about removing them. But I'm a
little beyond the boundary of my knowledge (although I stepped through it in
the debugger and it seemed pretty straight forward). Are there any hidden
side-effects/implications of the following? Specifically, after the
SystemDictionary is garbage collected, is the system exactly the same as it
was before the code was run? It seems like a better approach than creating
them in the global namespace and cleaning up.
testingEnvironment := SystemDictionary withOrganizer: SystemOrganizer new.
ClassBuilder new
name: #AClassForTesting
inEnvironment: testingEnvironment
subclassOf: Object
type: Object typeOfClass
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'TemporaryTesting'.
newClass := (testingEnvironment at: #AClassForTesting).
newClass
compile: 'greeting
^ ''hello there'''
classified: 'greeting'.
newClass new greeting. "Returns 'hello there'"
Thanks.
Sean
--
View this message in context:
http://forum.world.st/Creating-temporary-classes-for-testing-tp3080408p3080408.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.