[squeak-dev] What is the task of NullEncoder?

H. Hirzel hannes.hirzel at gmail.com
Sat Sep 30 08:57:38 UTC 2017

Tobias, thank you for referring to Marcel Weiher as the author of the
Postscript support in Squeak.
This helped me to find the following email with comments about the
Encoder hierarchy

Marcel Weiher
<marcel.weiher at gmail.com>	Wed, Feb 27, 2013 at 9:14 PM
To: The general-purpose Squeak developers list
<squeak-dev at lists.squeakfoundation.org>

On Feb 25, 2013, at 20:22 , Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
> Great, that confirms my own analyze.
> But the parallel hierarchy PrintEncoder StoreEncoder and
> PropertyListEncoder are presumably not used, and were just experiments
> right?

Pretty sure, yes.


So it seems that


are  a means to structure the code for the subclass PostscriptEncoder
and thus to help to understand how the code works (see attached screen


Note that Canvas and thus then PostscriptCanvas is a subclass of FlattenEncoder.
As Nicolas Cellier points out only PostscriptCanvas and subclasses use
the NullEncoder and FlattenEncoder protocols. For example
    aMorph asEPS
    ^ EPSCanvas morphAsPostscript: self rotated: false.
which at the end does
    ^target contents.
which is implemented in NullEncoder.

The question thus is how much does PostScriptCanvas rely on the
NullEncoder and FlattenEncoder protocols?

It might be quite easily possible  to reimplement the necessary
methods in PostScriptEncoder and then make Canvas a subclass of

This will allow Canvas and subclasses to be put into a separate
category 'Graphics-Canvas' in the base system.

PostScript support would then be something added on top of it.

To summarize:

The refactoring idea brought up for discussion is thus

1. Push the necessary NullEncoder and FlattenEncoder instance variable
'target' and the necessary methods down to PostscriptCanvas

2. Make Canvas a subclass of object thus separating then Encoder
hierarchy from the Canvas hierarchy.

3. Put Canvas and some subclasses into a category 'Graphics-Canvas'


Hannes Hirzel


On 9/30/17, Tobias Pape <Das.Linux at gmx.de> wrote:
>> On 30.09.2017, at 01:42, David T. Lewis <lewis at mail.msen.com> wrote:
>> According to the update stream history at http://files.squeak.org/history,
>> NullEncoder and friends were added in  1466EncodingFilters-MPW.cs by MPW:
>>   Object subclass: #NullEncoder
>>   NullEncoder subclass: #FlattenEncoder
>>   FlattenEncoder subclass: #ByteEncoder
>>   ByteEncoder subclass: #PrintableEncoder
>>   PrintableEncoder subclass: #PrintEncoder
>>   PrintableEncoder subclass: #PropertyListEncoder
>>   PrintableEncoder subclass: #StoreEncoder
>> According to SqueakMap, MPW is Mark McCahill (mccahill at duke.edu).
> No, thats Marcel Weiher. He did a quite a lot Squeak/Postscript Stuff.
> I CC'ed him.
> Marcel, can you comment on the Encoder Hierarchie?
> (Full thread here)
> Best regards
> 	-Tobias
>> According to Wikipedia, Mark McCahill at Duke is this guy:
>> https://en.wikipedia.org/wiki/Mark_P._McCahill
>> According to the method time stamps, these classes date back to January
>> 1901, so probably actually 2001.
>> Dave
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NullEncoder_FlattenEncoder_ByteEncoder_PrintableEncoder_Screenshot_2017-09-30.png
Type: image/png
Size: 279016 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20170930/2387af69/attachment-0001.png>

More information about the Squeak-dev mailing list