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

Don't append '.' to Erlang namespace if it ends in '_'.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.10.0
    • 0.11.0
    • Erlang - Compiler
    • None

    Description

      THRIFT-3834 added support for namespaces to the Erlang code generator. However, that support uses a . between the namespace name and the type name. This is inconvenient because, although . is a valid character in an Erlang atom, atoms that contain . must be quoted. This means that a struct named MyStruct in the namespace NS will cause a record named 'NS.MyStruct' to be generated. Here are the rules for naming atoms in Erlang:

      Atoms begin with a lower-case letter, and may contain alphanumeric characters, underscores (_) or at-signs (@). Alternatively atoms can be specified by enclosing them in single quotes ('), necessary when they start with an uppercase character or contain characters other than underscores and at-signs.

      I propose that if an Erlang namespace ends in a _ that no . be added between the namespace and the struct name when creating the record. This will preserve the current behavior unless the namespace ends is a _, but allow users to override the normal behavior by adding an explicit _ to the end of their namespace declarations.

      Attachments

        Issue Links

          Activity

            People

              dhull David Hull
              dhull David Hull
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: