Hi, This method sends super, resulting in a confusing printString. Fix printOn: aStream “Override
to not send super, to avoid double printing, and copy down Object>>printOn: to print the class. | title | title := self class printString. aStream nextPutAll:
((title at: 1) isVowel ifTrue:
['an '] ifFalse: ['a ']). aStream nextPutAll:
title. “super
printOn: aStream.” aStream nextPutAll: '(on: '; print: systemEvent; nextPutAll: ' at: '; print: sequence; nextPutAll: ' for: '; print: option; nextPutAll: ' send: '''; print: receiver; space; nextPutAll: selector; nextPutAll: ''')'. Do I get a T-Shirt? J This is when a super super would
be useful? |
Stewart,
Object>>basicPrintOn: is provided for precisely this. So the right fix IMO is printOn: aStream self basicPrintOn: aStream. aStream nextPutAll: '(on: '; print: systemEvent; nextPutAll: ' at: '; print: sequence; nextPutAll: ' for: '; print: option; nextPutAll: ' send: '''; print: receiver; space; nextPutAll: selector; nextPutAll: ''')'. What size is your teeshirt? ;) BTW, Dan Ingalls' and Alan Borning's multiple inheritance system provided self Object.printOn: aStream to solve the super super issue. I prefer self.Object printOn: aStream. But periods in selectors are no longer allowed :( On 6/7/07,
Stewart MacLean <[hidden email]> wrote:
|
Hi Eliot, On that basis, should Object>>printOn: aStream Not be Object>>printOn:
aStream "Append to
the argument aStream a sequence of characters that describes the receiver." self basicPrintOn: aStream ? Bear in mind it is 6am here, and I’m
still trying to package for Mac OS X… -----Original
Message----- Stewart, On 6/7/07, Stewart MacLean <[hidden email]> wrote: Hi, This method sends super, resulting in a confusing
printString. Fix printOn: aStream
"Override to not send super, to avoid double printing, and copy down
Object>>printOn: to print the class. 08/06/07 SIM" | title |
title := self class printString.
aStream nextPutAll:
((title at: 1) isVowel ifTrue: ['an '] ifFalse: ['a ']).
aStream nextPutAll: title. "super printOn: aStream."
aStream
nextPutAll: '(on: ';
print: systemEvent;
nextPutAll: ' at: ';
print: sequence;
nextPutAll: ' for: ';
print: option;
nextPutAll: ' send: ''';
print: receiver;
space;
nextPutAll: selector;
nextPutAll: ''')'. Do I get a T-Shirt? J This is when a super super would be useful? |
If only you were in Hawaii, I'd plead for a job ;)
Re Object>>printOn: you can argue either way. e.g. if it ain't broke don't fix it; printOn: predates basicPrintOn:... cheers!
On 6/7/07, Stewart MacLean <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |