On Sat, 03 Sep 2011 18:57:06 -0400, Andrej Mitrovic <andrej.mitrov...@gmail.com> wrote:

Also, changing structs to classes is gonna *massively* break code
everywhere. Why inheritance instead of a predicate like isInputStream
= is(typeof(T t; t.put; t.close)), you know the drill..

Because it breaks runtime swapping of I/O.

For example, if you wanted to change stdin to a network socket, it's simple, just assign another InputStream.

However, if stdin is a templated struct, you cannot do this at runtime, you have to decide at compile time what your stdin is. Believe it or not, this is not dissimilar to FILE *, except we have more flexibility.

But I realize the implications now. I think I have to revisit this decision.

We definitely need classes at the lower level, but I think we can wrap them with structs that are commonly used for RAII and for not breaking existing code.

-Steve

Reply via email to