-
Type:
Improvement
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 0.9
-
Fix Version/s: 0.9.1
-
Component/s: C# - Compiler
-
Labels:None
-
Patch Info:Patch Available
It would be better to have a static Read(TProtocol iprot) which returns the type rather than a non-static Read that needs a type.
I noticed this while working on THRIFT-1783, as well as THRIFT-1786.
For THRIFT-1783, a static Read would allow for the non parameter constructor to be private, while the other Reads that need the struct would still work.
For THRIFT-1786, you can't initialize the abstract type, and you don't know what the type is until after the field identifier is read.
A few ways to do this (the way that I have implemented already is the first):
- Remove Read() from TBase, and make all users use the static implementations
- Add a new TBase (TWriteBase) which only has the write as part of the interface, then add a command line option to create the new way of creating these static Read objects