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

OCaml generator to take default values into account

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.3
    • Fix Version/s: 0.4
    • Component/s: OCaml - Compiler
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      A patch to the OCaml generator which uses default values defined in the .thrift file to initialize the members of the generated class.

      I've prepared an OCaml generator patch against the current Thrift SVN trunk. The generated code:

      • makes unwrapped types for all fields for which default values are defined,
      • honors the protocol-centric semantics for the "required" field: such fields are always serialized,
      • throws exception instead of skipping "required" fields which do not have a set value,
      • avoids encoding values of "optional" and absent-requiredness fields if the field value is structurally equivalent to the field's default value,
      • does not break compatibility with C++ receivers,
      • is drop-in compatibe with OCaml code generated by the OCaml generator in the unmodified trunk

      For the full description of changes see paragraph 3.2 in http://lionet.livejournal.com/66899.html

        Attachments

          Activity

            People

            • Assignee:
              vlm Lev Walkin
              Reporter:
              vlm Lev Walkin
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: