[jira] [Commented] (THRIFT-3546) NodeJS code should not be namespaced (and is currently not strict-mode compliant)

2016-10-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15569152#comment-15569152
 ] 

ASF GitHub Bot commented on THRIFT-3546:


Github user asfgit closed the pull request at:

https://github.com/apache/thrift/pull/


> NodeJS code should not be namespaced (and is currently not strict-mode 
> compliant)
> -
>
> Key: THRIFT-3546
> URL: https://issues.apache.org/jira/browse/THRIFT-3546
> Project: Thrift
>  Issue Type: Bug
>  Components: Node.js - Compiler
>Affects Versions: 0.9.3
>Reporter: Yunchi Luo
>
> Code generated for NodeJS, whether with a js namespace specified or not, 
> seems to fail strict mode. Specifically, it doesn't always generate "var" 
> when needed. This might not sound like a big issue but it's quite a pain to 
> deal with...
> It is standard nowadays to enable strict mode for Javascript code 
> (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode).
>  And babel, which is one of most popular ES6 => ES5 transpilers, while does 
> not force strict mode, does seem to break when you don't use "var".
> I think the best solution here is really to just stop using namespaces in 
> node code. Every type will be declared with "var", and if exported, also 
> assigned to "module.exports".
> I don't believe namespaces currently generated in the node code is directly 
> used anywhere or is even accessible outside the file?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3546) NodeJS code should not be namespaced (and is currently not strict-mode compliant)

2016-10-12 Thread Randy Abernethy (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15568897#comment-15568897
 ] 

Randy Abernethy commented on THRIFT-3546:
-

+1

> NodeJS code should not be namespaced (and is currently not strict-mode 
> compliant)
> -
>
> Key: THRIFT-3546
> URL: https://issues.apache.org/jira/browse/THRIFT-3546
> Project: Thrift
>  Issue Type: Bug
>  Components: Node.js - Compiler
>Affects Versions: 0.9.3
>Reporter: Yunchi Luo
>
> Code generated for NodeJS, whether with a js namespace specified or not, 
> seems to fail strict mode. Specifically, it doesn't always generate "var" 
> when needed. This might not sound like a big issue but it's quite a pain to 
> deal with...
> It is standard nowadays to enable strict mode for Javascript code 
> (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode).
>  And babel, which is one of most popular ES6 => ES5 transpilers, while does 
> not force strict mode, does seem to break when you don't use "var".
> I think the best solution here is really to just stop using namespaces in 
> node code. Every type will be declared with "var", and if exported, also 
> assigned to "module.exports".
> I don't believe namespaces currently generated in the node code is directly 
> used anywhere or is even accessible outside the file?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3546) NodeJS code should not be namespaced (and is currently not strict-mode compliant)

2016-10-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15565717#comment-15565717
 ] 

ASF GitHub Bot commented on THRIFT-3546:


Github user jfarrell commented on the issue:

https://github.com/apache/thrift/pull/
  
at quick run through patch looks ok to me, @Jens-G @RandyAbernethy can 
either of you please review also


> NodeJS code should not be namespaced (and is currently not strict-mode 
> compliant)
> -
>
> Key: THRIFT-3546
> URL: https://issues.apache.org/jira/browse/THRIFT-3546
> Project: Thrift
>  Issue Type: Bug
>  Components: Node.js - Compiler
>Affects Versions: 0.9.3
>Reporter: Yunchi Luo
>
> Code generated for NodeJS, whether with a js namespace specified or not, 
> seems to fail strict mode. Specifically, it doesn't always generate "var" 
> when needed. This might not sound like a big issue but it's quite a pain to 
> deal with...
> It is standard nowadays to enable strict mode for Javascript code 
> (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode).
>  And babel, which is one of most popular ES6 => ES5 transpilers, while does 
> not force strict mode, does seem to break when you don't use "var".
> I think the best solution here is really to just stop using namespaces in 
> node code. Every type will be declared with "var", and if exported, also 
> assigned to "module.exports".
> I don't believe namespaces currently generated in the node code is directly 
> used anywhere or is even accessible outside the file?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3546) NodeJS code should not be namespaced (and is currently not strict-mode compliant)

2016-10-11 Thread Benjamin Gould (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15565392#comment-15565392
 ] 

Benjamin Gould commented on THRIFT-3546:


Added to my PR to emit a "use strict" directive at the top of generated node.js 
files and confirmed that they work properly in Chrome and Firefox when run 
through browserify.

Additionally, I confirmed that the generated code can be used with babel.

> NodeJS code should not be namespaced (and is currently not strict-mode 
> compliant)
> -
>
> Key: THRIFT-3546
> URL: https://issues.apache.org/jira/browse/THRIFT-3546
> Project: Thrift
>  Issue Type: Bug
>  Components: Node.js - Compiler
>Affects Versions: 0.9.3
>Reporter: Yunchi Luo
>
> Code generated for NodeJS, whether with a js namespace specified or not, 
> seems to fail strict mode. Specifically, it doesn't always generate "var" 
> when needed. This might not sound like a big issue but it's quite a pain to 
> deal with...
> It is standard nowadays to enable strict mode for Javascript code 
> (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode).
>  And babel, which is one of most popular ES6 => ES5 transpilers, while does 
> not force strict mode, does seem to break when you don't use "var".
> I think the best solution here is really to just stop using namespaces in 
> node code. Every type will be declared with "var", and if exported, also 
> assigned to "module.exports".
> I don't believe namespaces currently generated in the node code is directly 
> used anywhere or is even accessible outside the file?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3546) NodeJS code should not be namespaced (and is currently not strict-mode compliant)

2016-10-06 Thread Benjamin Gould (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15552929#comment-15552929
 ] 

Benjamin Gould commented on THRIFT-3546:


The above PR also fixes THRIFT-3835 if I am not mistaken.

> NodeJS code should not be namespaced (and is currently not strict-mode 
> compliant)
> -
>
> Key: THRIFT-3546
> URL: https://issues.apache.org/jira/browse/THRIFT-3546
> Project: Thrift
>  Issue Type: Bug
>  Components: Node.js - Compiler
>Affects Versions: 0.9.3
>Reporter: Yunchi Luo
>
> Code generated for NodeJS, whether with a js namespace specified or not, 
> seems to fail strict mode. Specifically, it doesn't always generate "var" 
> when needed. This might not sound like a big issue but it's quite a pain to 
> deal with...
> It is standard nowadays to enable strict mode for Javascript code 
> (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode).
>  And babel, which is one of most popular ES6 => ES5 transpilers, while does 
> not force strict mode, does seem to break when you don't use "var".
> I think the best solution here is really to just stop using namespaces in 
> node code. Every type will be declared with "var", and if exported, also 
> assigned to "module.exports".
> I don't believe namespaces currently generated in the node code is directly 
> used anywhere or is even accessible outside the file?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3546) NodeJS code should not be namespaced (and is currently not strict-mode compliant)

2016-10-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15552922#comment-15552922
 ] 

ASF GitHub Bot commented on THRIFT-3546:


GitHub user bgould opened a pull request:

https://github.com/apache/thrift/pull/

THRIFT-3546: Remove global namespace objects from nodejs generated code

Modified the node.js code generator to not generate namespace object by 
default, as using require() is the idiomatic way to reference classes contained 
in other modules for node, instead of relying on a object heirarchy existing in 
the global namespace.

This change makes the generated code work under Javascript's "use strict" 
mode.

In case others are relying on the existing behavior, I added a ":with_ns" 
flag to the compiler that enables the current behavior for backwards 
compatibility.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/bgould/thrift THRIFT-3546

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/thrift/pull/.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #


commit 10d11d733bfec328b94e1a3d70675f67cbc44312
Author: BCG 
Date:   2016-10-05T14:25:27Z

Removed namespace objects from nodejs generated code, and added with_ns 
option for backwards compatibility.




> NodeJS code should not be namespaced (and is currently not strict-mode 
> compliant)
> -
>
> Key: THRIFT-3546
> URL: https://issues.apache.org/jira/browse/THRIFT-3546
> Project: Thrift
>  Issue Type: Bug
>  Components: Node.js - Compiler
>Affects Versions: 0.9.3
>Reporter: Yunchi Luo
>
> Code generated for NodeJS, whether with a js namespace specified or not, 
> seems to fail strict mode. Specifically, it doesn't always generate "var" 
> when needed. This might not sound like a big issue but it's quite a pain to 
> deal with...
> It is standard nowadays to enable strict mode for Javascript code 
> (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode).
>  And babel, which is one of most popular ES6 => ES5 transpilers, while does 
> not force strict mode, does seem to break when you don't use "var".
> I think the best solution here is really to just stop using namespaces in 
> node code. Every type will be declared with "var", and if exported, also 
> assigned to "module.exports".
> I don't believe namespaces currently generated in the node code is directly 
> used anywhere or is even accessible outside the file?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3546) NodeJS code should not be namespaced (and is currently not strict-mode compliant)

2016-10-06 Thread Benjamin Gould (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15552898#comment-15552898
 ] 

Benjamin Gould commented on THRIFT-3546:


I have a fix for this that eliminates the namespace object heirarchy in node.js 
generated code, and adds a compiler flag that can be used for backwards 
compatibility if necessary.

I think that not generating the namespace objects for node.js/browserify is a 
sensible default behavior because for node.js/browserify it is idiomatic to use 
require() rather than relying on objects being in the global namespace (which 
makes me doubt that very many developers if any are relying on that behavior).

Github PR coming shortly.

> NodeJS code should not be namespaced (and is currently not strict-mode 
> compliant)
> -
>
> Key: THRIFT-3546
> URL: https://issues.apache.org/jira/browse/THRIFT-3546
> Project: Thrift
>  Issue Type: Bug
>  Components: Node.js - Compiler
>Affects Versions: 0.9.3
>Reporter: Yunchi Luo
>
> Code generated for NodeJS, whether with a js namespace specified or not, 
> seems to fail strict mode. Specifically, it doesn't always generate "var" 
> when needed. This might not sound like a big issue but it's quite a pain to 
> deal with...
> It is standard nowadays to enable strict mode for Javascript code 
> (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode).
>  And babel, which is one of most popular ES6 => ES5 transpilers, while does 
> not force strict mode, does seem to break when you don't use "var".
> I think the best solution here is really to just stop using namespaces in 
> node code. Every type will be declared with "var", and if exported, also 
> assigned to "module.exports".
> I don't believe namespaces currently generated in the node code is directly 
> used anywhere or is even accessible outside the file?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)