Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1793

C#: Use static read instead of instance read

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • 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

      Description

      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

        Attachments

        1. 1793.patch
          8 kB
          Carl Yeksigian

          Activity

            People

            • Assignee:
              carlyeks Carl Yeksigian
              Reporter:
              carlyeks Carl Yeksigian

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment