#148 InStream/OutStream

andy Wed 25 Jul 2007

We decided tonight to change InStream and OutStream to be classes from mixins. There were two reasons we decided to to this.

One was that the Java/C# interfaces for these two objects contain two additional methods for doing read/write using primitive ints (not boxed like the Fan API), so they will perform better when doing things like binary I/O. Trying to keep that in there would require additional classes in sys and some clever dynamic emitting so that descendants wouldn't have to implement those special methods. We decided it was simpler to just make them classes.

The other was for wrapping streams. We don't currently have a way to wrap streams in other streams. Keeping them mixins would have required unnecessary overhead. But if we make them classes we can route primitive read/write methods to the wrapped stream. So both streams will get a new ctor called wrap that takes another stream.

As a result Buf isn't quite as elegant, because now it will need to expose two properties (in/out) for each respective stream. But we decided to keep the API the same and make the existing methods simply convenience ice for buf.in.xxx or buf.out.xxx.

brian Thu 26 Jul 2007

First step is complete: Buf no longer implements InStream or OutStream. I left most of the stream methods in place as conveniences though.

brian Sat 28 Jul 2007

This change is done - InStream and OutStream are now classes.

Login or Signup to reply.