After looking closely at the OutStream API, I have some remarks about virtual methods/fields in OutStream:
What are your thoughts about that?
And I guess the same should apply to InStream. i.e.
I am not sure why endian and charset are virtual. I think that might be hold over from before we had some of the field features. I don't have any problem making those non-virtual. If this will break anyone's code, please speak up now.
I originally make print and printLine for covariance, but that has since been solved with the This type. So I say we can make those non-virtual too.
The reason that the char methods are non-virtual is that the charset determines how to encode/decode character codes into bytes. The only role of a subclass should be to how to perform I/O of those bytes.
So unless there any objections, I will be make all of those non-virtual for next build.
What you propose seems fine with me.
The only problem I see if readChar and readChars are not virtual, is that it'll be impossible to implement a character-only OutStream (like StrBufOutStream). Currently, the java implementation of StrBufOutStream overrides those two methods to append characters to the StrBuf, and it overrides write and writeBuf to make them throw exceptions (as a StrBuf does not support binary writes).
But if someone would like to implement the same thing directly in Fantom, it'll be impossible. Not sure it's a real problem though.
Promoted to ticket #1526 and assigned to brian
Ticket resolved in 1.0.59
I removed the virtual from these slots:
Login or Signup to reply.