Dan Cromer created THRIFT-1646:
----------------------------------

             Summary: NodeJS compiler generates invalid namespaced JavaScript
                 Key: THRIFT-1646
                 URL: https://issues.apache.org/jira/browse/THRIFT-1646
             Project: Thrift
          Issue Type: Bug
          Components: Node.js - Compiler
    Affects Versions: 0.8
         Environment: Any.
            Reporter: Dan Cromer
            Priority: Minor
             Fix For: 0.9


OVERVIEW

In Thrift's IDL, it's possible to specify that generated code be namespaced in 
Javascript.  Example:

namespace js my.namespace

struct mystruct {
...
}

When the IDL is compiled, mystruct should be available as 
my.namespace.mystruct.  The NodeJS compiler behaves as if this were normal 
JavaScript, assuming that my and my.namespace have been initialized!  However, 
because NodeJS apps use require() to load modules, mystruct will fail to 
initialize, as 'my' and 'my.namespace' were never initialized as objects.

SUGGESTED RESOLUTION

On one hand, this is a low-impact issue.  Because require() allows 
library-consumers to namespace exported modules however they like, namespacing 
can be completely omitted without any negative impact to the application.

However, this is a very easy mistake to make, and a confusing one to debug.  
Generated code should 'just work,' regardless of the idiosyncrasies of a 
particular language (JavaScript + require()).


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to