We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/ElemeFE/node-interview/blob/master/sections/module.md#%E6%A8%A1%E5%9D%97%E6%9C%BA%E5%88%B6
“热更新”部分说“这里留下一个简单的问题, 既然可以通过新的上下文来避免污染, 那么为什么 Node.js 不给每一个.js文件以独立的上下文来避免作用域被污染?”
这里的答案是独立的上下文不会防止作用域被污染吧,因为node的vm模块创建的独立上下文中是可以访问到独立变量吧?
The text was updated successfully, but these errors were encountered:
这个地方个人感觉是文字游戏啦,独立的上下文阻止的是对全局作用域的污染,按照文中的用语,应该是防止对Node默认的VM的污染。作用域的话应该是指模块的作用域,因为本来就是局部的,所以不需要独立的上下文也不会被污染。 不过还是希望作者出来确认下啦,我是有点没太明白这里想问的是啥 T_T
Sorry, something went wrong.
可以当做脑筋急转弯。对其了解到不同深度的人会给出不同的想法。
Feel free to reopen.
No branches or pull requests
https://github.com/ElemeFE/node-interview/blob/master/sections/module.md#%E6%A8%A1%E5%9D%97%E6%9C%BA%E5%88%B6
“热更新”部分说“这里留下一个简单的问题, 既然可以通过新的上下文来避免污染, 那么为什么 Node.js 不给每一个.js文件以独立的上下文来避免作用域被污染?”
这里的答案是独立的上下文不会防止作用域被污染吧,因为node的vm模块创建的独立上下文中是可以访问到独立变量吧?
The text was updated successfully, but these errors were encountered: