[
https://issues.apache.org/jira/browse/THRIFT-1646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jake Farrell updated THRIFT-1646:
---------------------------------
Fix Version/s: (was: 0.9.2)
> 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
> Assignee: Henrique Mendonça
> Priority: Minor
> Labels: node, nodejs
>
> 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 was sent by Atlassian JIRA
(v6.1.5#6160)