David Hull created THRIFT-4269:
----------------------------------
Summary: Don't append '.' to Erlang namespace if it ends in '_'.
Key: THRIFT-4269
URL: https://issues.apache.org/jira/browse/THRIFT-4269
Project: Thrift
Issue Type: Improvement
Components: Erlang - Compiler
Affects Versions: 0.10.0
Reporter: David Hull
Priority: Minor
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:
bq. 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.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)