Actually class variables are stored in a dictionary in a class. You can access that by saying: aClass classPool. So resetting all values of a class variable could be easily done with something like aClass classPool keys do: [ :k | aClass classPool at: k put: nil ]. Maybe that could be a nice addition. On Sat, Jul 29, 2017 at 9:51 AM, Ben Coman <btc@openinworld.com> wrote:
I want to reset all the class variables in an application to nil. I've got as far as finding them, for example...
packages := RPackageOrganizer default packages select:[:p| (p name includesSubstring: 'PharoLauncher') ]. stateToReset := packages flatCollect: [:p| p definedClasses select:[:c | (c classVarNames size > 0) and: [(c name includesSubstring: 'Configuration') not]] thenCollect:[:c| c-> c classVarNames] ]. stateToReset asDictionary keysAndValuesDo:[:class :variables| variables do: [:v| Transcript crShow: 'Clear ', class printString, ' -> ' , v printString]. ].
What could go in place of the Transcript line to set them to nil?
cheers -ben
-- Guille Polito Research Engineer French National Center for Scientific Research - *http://www.cnrs.fr* <http://www.cnrs.fr> *Web:* *http://guillep.github.io* <http://guillep.github.io> *Phone: *+33 06 52 70 66 13