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

Extending struct_info for erlang bindings

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.7
    • Component/s: Erlang - Compiler
    • Labels:
    • Patch Info:
      Patch Available


      In addition to recently fixed THRIFT-27, I've made some extra changes, if no one objects.

      In this patch i've added more type specifiers to generated records.
      Now it covers all possible types (I've forgot about set(), map() and #another_record{}).
      It now initializes all record fields without default value with 'undefined'.
      This is a bit redundant, but I like it. (maybe you're not? let me know if you have some objections!).

      Also in this patch adds generation of additional structure info, that might be useful from runtime.
      It contains:

      • FieldID,
      • FieldReq,
      • FieldType
      • Identifier
      • ConstValue

      ConstValue is constructed everytime when struct_info_ext(...) is called.
      This isn't good, but perhaps, it is ok if erlang optimizes such things. Does it?

      I planned to use struct_info_ext(...) in further modifications of erlang thrift library, to implement runtime validation of presence of required fields during reading/writing, and to avoid encoding of optional fields with default values. But it is pretty usable of itself.


        1. thrift-1086852.diff
          14 kB
          Anatoly Kanivetsky



            • Assignee:
              chaos-ad Anatoly Kanivetsky
              chaos-ad Anatoly Kanivetsky


              • Created:

                Issue deployment