[
https://issues.apache.org/jira/browse/THRIFT-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12733749#action_12733749
]
Todd Lipcon commented on THRIFT-544:
------------------------------------
I agree with David here - the breaking of backwards compatibility seems like
too much to me to be worth it.
On the other hand, I might support a patch which changes enum generation in
erlang to use atoms like 'A' and 'B' instead of -defines at all. It's more
erlangy - the bindings use -defines here for historical reasons. Since I'm no
longer an active user of the bindings, though, I'll defer to Eugene, Chris, and
David (or anyone else who uses them and wants to pipe up) for whether they
think that's a good idea.
> multiple enums with the same key generate invalid code
> ------------------------------------------------------
>
> Key: THRIFT-544
> URL: https://issues.apache.org/jira/browse/THRIFT-544
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (Erlang)
> Affects Versions: 0.1
> Reporter: Ben Taitelbaum
> Priority: Minor
> Fix For: 0.1
>
> Attachments: thrift-544_add_enum_name_to_enum_keys.patch
>
>
> The current generator produces multiple -define statements with the same
> name, which isn't valid erlang code (and also isn't valid semantically if we
> want two different values).
> {code:title=EnumTest.thrift|borderStyle=solid}
> enum MyType1 {
> A = 0,
> B = 1
> }
> enum MyType2 {
> A = 2,
> C = 4
> }
> {code}
> produces:
> {code:title=enumTest_types.hrl|borderStyle=solid}
> -ifndef(_enumTest_types_included).
> -define(_enumTest_types_included, yeah).
> -define(enumTest_A, 0).
> -define(enumTest_B, 1).
> -define(enumTest_A, 2).
> -define(enumTest_C, 4).
> -endif.
> {code}
> In the patched version, it produces this:
> {code:title=enumTest_types.hrl|borderStyle=solid}
> -ifndef(_enumTest_types_included).
> -define(_enumTest_types_included, yeah).
> -define(enumTest_MyType1_A, 0).
> -define(enumTest_MyType1_B, 1).
> -define(enumTest_MyType2_A, 2).
> -define(enumTest_MyType2_C, 4).
> -endif.
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.