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

Marcel Weiher marcel at metaobject.com
Sun Oct 1 09:23:19 UTC 2017


> On Sep 30, 2017, at 7:34 , Tobias Pape <Das.Linux at gmx.de> wrote:
> 
> 
> 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)

Hi Tobias et al,

thanks for tagging me.  :-)

The “Encoder” classes are a Squeak version of an “object oriented pipes and filters” system I implemented in Objective-C in the late 90s:  https://github.com/mpw/MPWFoundation/tree/master/Streams.subproj <https://github.com/mpw/MPWFoundation/tree/master/Streams.subproj>

Why?  Well, because the Postscript generation code was based on my Objective-C Postscript processing code (http://www.metaobject.com/Technology/#EGOS <http://www.metaobject.com/Technology/#EGOS>), which is heavily based on these filters.

I have found the filters to be incredibly useful over the last 20 years, partly because they compose so well:  just like Unix pipes and filters, they are symmetric so that their input protocol ( #writeObject: ) is the same as their output protocol ( #writeObject:).  The filterSelector is there to allow filter-specific processing using double dispatch, but once the processing is done the result is once again normalized to a #writeObject:  You can therefore combine these filters any way you want.  




Another feature is that they are, like Unix filters, fundamentally incremental, so multiple processing steps are interleaved and both input and output can stream directly to/from disk/network.  When doing pre-press in the early 90ies (file sizes >> memory sizes) this was a useful feature, and it is still helpful today, see for example the first part of my UIKonf talk:

	https://www.youtube.com/watch?v=kHG_zw75SjE

More recently, the fact that filters are dataflow-oriented and therefore don’t care much about the control flow has made them useful in implementing asynchronous processing pipelines  Think “FRP” just simpler, more readable and faster.  The Microsoft To-Do network stack is implemented using this.

With all the references to Unix P/F, it is probably no surprise that this also subsumes Unix I/O, just with the advantage of an OO hierarchy of shareable behavior.  Oh, and also the interesting feature of subsuming both filters and (output) streams, so ‘stdout’ in Objective-Smalltalk is one of these, a ByteStream that knows how to serialize objects and output them to some target that expects bytes.  And in ‘stsh’ it’s a slight variant of MPWByteStream that is more helpful to a human interacting.









-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171001/370aca7e/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filterstreams.pdf
Type: application/pdf
Size: 35080 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171001/370aca7e/attachment-0002.pdf>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171001/370aca7e/attachment-0004.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filterstream-hierarchy.pdf
Type: application/pdf
Size: 39651 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171001/370aca7e/attachment-0003.pdf>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171001/370aca7e/attachment-0005.html>


More information about the Squeak-dev mailing list