[
https://issues.apache.org/jira/browse/THRIFT-2009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13720051#comment-13720051
]
Jens Geyer commented on THRIFT-2009:
------------------------------------
[~nairboon],
that's basically what I said, it conflicts with the Name. It is however very
unlikely that chooosing a different name will solve the underlying issue. It
may then work for this special case, but create another new one, where it
doesn't work.
And the main issue is caused by the fact, that in essence different namespaces
were mixed: the identifiers coming from the IDL, and the names that are added
by compiler/library or convention, plus the identifiers that are part of the
normal Go infrastructure, like reserved keywords or the like. The good news
(ok, not really good) is: To some extent, all languages are facing similar
problems.
One proposal could be to actively detect such problems in the compiler and do
some name mangling, like adding an underscore. That is no bullet-proof way
either, but it will help in most cases.
BTW, I didn't make up this test case, it hit me while trying a real-world
example.
> Go redeclaration error
> ----------------------
>
> Key: THRIFT-2009
> URL: https://issues.apache.org/jira/browse/THRIFT-2009
> Project: Thrift
> Issue Type: Bug
> Components: Go - Compiler
> Reporter: Jens Geyer
>
> The following IDL code works perfectly with other languages:
> {code}
> namespace * Test
> struct Project {
> 1 : required string projectID
> }
> struct NewProject {
> 1 : required string name
> }
> service Sample {
> Project CreateNewProject( 1: NewProject project)
> }
> {code}
> The result I get here is
> {quote}
> gen-go\Test\Sample.go:455: missing argument to conversion to NewProject:
> NewProject()
> gen-go\Test\ttypes.go:191: NewProject redeclared in this block
> previous declaration at gen-go\Test\ttypes.go:25
> {quote}
> Seems as if the generated NewProject() method conflicts with the struct name.
> As my Go knowledge is somewhat limited, I'm not sure about whether or not
> this issue blocks the acceptance of THRIFT-1980, so I created a new ticket.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira