=== Top of the Swiki === Attachments ===

IOHandle

IOHandle adds classes which represent input/output on external channels, such as files or sockets. The FileStream and Socket hierarchies are modified to collaborate with instances of IOHandle rather than directly call primitives.

I did this as an experiment to see if I could move the represention of external input/output connections into a separate class hierarchy, so as to take the responsibility for the IO connection out of classes such as Socket and StandardFileStream. This should help to unclutter the FileStream and Socket hierarchies, and simplify the job of refactoring these classes. I didn't bother to make an IOHandle subclass for AsyncFileStreams, but the same principle would apply.

I think that the IOHandle concept lines up more or less with Craig Latta's ExternalResource class (a better name for the idea, by the way). I was paying more attention to file handles than network handles, with the unix-like idea that all of these external things could be made to "look like" files.

It is still an open question in my mind as to whether a Socket should be collaborate with an IOSocketHandle, or if it should itself be a subclass of IOHandle. I lean towards collaboration, since the Socket classes contain a lot of behavior which is not directly related to the IO channel itself.

This change set should not be considered for inclusion in the Squeak image, as there are some machine dependencies and possible performance side effects that I have deliberately left in the code. It's just a proof of concept, but if folks think it's a useful direction, I can clean it up and make it suitable for real use.

The change set must be loaded in two parts:

  • iohandle-part-1.20nov513pm.cs
  • iohandle-part-2.20nov513pm.cs

    Please load it into an image you don't mind throwing away, as the changes are not easily reversed.

    Comments?