[fpc-devel] A suggestion about streams
sergei_gorelkin at mail.ru
Fri Jun 30 13:59:35 CEST 2006
Currently, TStream.Read and TStream.Write methods are abstract.
This means that each and every descendant of TStream must override these
methods with their implementation.
FCL has many read-only or write-only TStream descendants, which
override Read or Write methods just to indicate that method is
unusable, i.e. raise some kind of exception.
Why not implement TStream.Read and TStream.Write like this:
raise EStreamError.CreateFmt('Reading is not supported by %s',
Since ClassName will be the actual name of the class which executed
the call, such implementation will give correct and meaningful error
message for every descendant class.
Then, all FCL code can be cleaned from similar procedures.
What is your opinion? It looks that such modification will not cause
any incompatibilities with existing code. And if you are not against,
I can do the required patching.
More information about the fpc-devel