ClassStub>>printOn:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ClassStub>>printOn:

Maxim Fridental
ClassStub>>printOn: may fail if the class locator can't find the class (f.
ex. the corresponding package isn't loaded). A patch:

printOn: aStream
 "Append, to aStream, a String whose characters are a description of the
receiver."

 | name |
 [name := self class name] on: Error do: [:ex | name := 'invalid
ClassStub'].
 aStream
  nextPutAll: (name first isVowel ifTrue: ['an '] ifFalse: ['a ']);
  nextPutAll: name;
  nextPut: $(;
  print: classLocator;
  nextPut: $)