There's a discussion on the VisualWorks NC mailing list talking about extending the PrintConverter. The only way to make the PrintConverter handle new formats is to either override the existing methods in the PrintConverter or to subclass the PrintConverter. Subclassing the PrintConverter could end up with a plethora of subclasses classes that can all handle a subset of the formats. Overriding the existing methods is a nightmare if you want to add several new formats from different packages.
This is a good place to use a Pragma. First, define a new class method for PrintConverter to allow it to support Pragmas.
formatPragma
<pragmas: #class>
^#(#format:send:)
Now, in the PrintConverter class>> for:withFormatString: method, add the following before the last line:
(Pragma allNamed: #format:send: in: self class) do: [:pragma |
pragma withArgumentsDo: [:formatString :selector |
aSymbol == formatString
ifTrue: [^self new perform: selector with: aString]]].
Now, you can extend the PrintConverter to your heart's content. Any time you want to add a new converter, extend PrintConverter and add a class method like this:
sampleExtendedFormat
<format: #sample send: #initForSample:>
Now, define initForSample: as an instance method in the class extension of PrintConverter and get it to do the formatting you want.