[squeak-dev] Re: [ANN] CoroutineReadStream (again)

Colin Putney cputney at wiresong.ca
Tue Dec 15 00:30:18 UTC 2009


On 2009-12-14, at 12:10 PM, Stephen Pair wrote:

> Can you describe how it would be used with Filesystem?

Filesystem makes use of a Guides and Visitors pattern for traversing directory trees. The guides drive execution, walking around the filesystem in a specific order, and sending #visitDirectory: and #visitFile: to their visitor. You implement directory-tree operations by implementing a subclass of FSVisitor. 

That all works fine, but I'd like to provide a bit of flexibility in the interface. The idea was to provide a CoroutineVisitor that would transform the visiting callbacks into a ReadStream interface. Then you could do something like this:

stream := FSBreathFirstGuide readStreamOn: aReference.

Now, the guides that Filesystem provides are written in such a way that it wouldn't be too hard to invert control and provide a stream interface without coroutines. But I want it to be easy for client applications to implement guides, and not being able to keep state on the activation stack would make things difficult. 

Colin


More information about the Squeak-dev mailing list