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

C#: Use static read instead of instance read

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9
    • 0.9.1
    • C# - Compiler
    • None
    • 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

            carlyeks Carl Yeksigian
            carlyeks Carl Yeksigian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: