Status: Accepted
Owner: [email protected]

New issue 3802 by [email protected]: A strange superclasses if Canvas
http://code.google.com/p/pharo/issues/detail?id=3802


Imagine that you can do something like:


Object new drawOnCanvas: World assuredCanvas

no, don't imagine. You can do that! :)
At least it is supposed to work, because Canvas inherits from some strange things (NullEncoder, FlattenEncoder),
so you can actually instruct any object to draw itself on canvas..
which is makes some sense (sort of):

Canvas>>draw: anObject
        ^anObject drawOn: self


Object>>drawOnCanvas:aStream
        self flattenOnStream:aStream.

But as to me, Object should NOT implement #drawOnCanvas:, nor #drawOn:. Period.

The real users of protocols placed in NullEncoder and FlattenEncoder is PostscriptCanvas which are not included into core images.


So, the proposal is to remove the extra noise by making Canvas to be the subclass of Object. And for things which do care about serializing drawing commands onto some stream (like PostScriptCanvas do), make a subclass and introduce this behavior later.




Reply via email to