Hello All,
Is it possible given a set of classes with known
shared variable name(s) for each, to run through those classes and clear the
shared variable (setters not available)?
behavior sharedVarNamed: 'nm' put: nil?
Shared vars are a bit different
than class vars, I think, so maybe this is not possible.
Thank you,
Gary P
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
You can send #initialize to a binding like so: #{YourClass.SharedVariable} initialize. To initialize all shared variables of a class, you can use: aClass asNameSpace bindingReferences do: #initialize. Kind Regards Karsten Karsten Kusche - Dipl. Inf. (FH) - [hidden email] Georg Heeg eK - Köthen Handelsregister: Amtsgericht Dortmund A 12812 Am Mittwoch, 9. Oktober 2013 um 11:20 schrieb Gary Peterson:
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
I’m not sure Karsten’s code does what you want: #initialize will run the initializer, if there is one, or be a no-op if not. Initializers almost never set a value to nil, since that is the default without an initializer, so you’d be unlikely to get the nil value you asked for in your question. If you want to nil all the values, do: SystemUtils modifySystem: [[Graph localNamesAndBindingsDo: [:n :cvb | cvb setValue: nil]] on: ConstantBindingModificationError do: [:ex| ex resume]]. This will handle all the shared variables defined in this class itself – recursing to superclasses is kind of dangerous. Note the need to do modifySystem (I think) and to handle the case where the shared var has constant: true – ignore the error and nil it anyway. All the best, Steve From: [hidden email] [mailto:[hidden email]] On Behalf Of Karsten Kusche You can send #initialize to a binding like so: #{YourClass.SharedVariable} initialize. To initialize all shared variables of a class, you can use: aClass asNameSpace bindingReferences do: #initialize. Kind Regards Karsten -- Karsten Kusche - Dipl. Inf. (FH) - [hidden email] Georg Heeg eK - Köthen Handelsregister: Amtsgericht Dortmund A 12812 Am Mittwoch, 9. Oktober 2013 um 11:20 schrieb Gary Peterson:
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |