On Wed 26 Aug, Maurice Rabb wrote:
MessageTally>>printOn: aStream | aSelector className | aSelector _ class selectorAtMethod: method setClass: [:aClass]. <------------------- NOTE#1 className _ aClass name contractTo: 30.
Is this a this good or bad style? How is it even possible given the scoping once the recusive method has returned?
It's not only poor style, it shouldn't compile!
It only works because the compiler adds 'aClass' to the method's list of temps when it discovers it in the block, and then doesn't rescind its scope correctly and the doens't take notice of it later. I did some hacking to make block temps work a while ago that 'fixed' this, I'll try to remember to extract the relevant bits tomorrow.
What should be written there is ........setClass:[:aClass| theClass := aClass]. and 'the Class' would need be a proper method temp.
tim
squeak-dev@lists.squeakfoundation.org