You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Henrique Mendonça (JIRA)" <ji...@apache.org> on 2015/02/09 09:51:34 UTC

[jira] [Updated] (THRIFT-1646) NodeJS compiler generates invalid namespaced JavaScript

     [ https://issues.apache.org/jira/browse/THRIFT-1646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henrique Mendonça updated THRIFT-1646:
--------------------------------------
    Fix Version/s: 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
>             Fix For: 0.9.2
>
>
> 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.3.4#6332)