2

I have a little RPC library for node, and right now it uses harmony proxies for remote objects if they are available (by checking for the existence of a Proxy global).

I'd like to be able to turn harmony proxies on at runtime, that is, in a node process that was not started with the --harmony-proxy flag. Is this possible?

I understand that there are good reasons not to do this, and I don't really care :-P

EDIT As pointed out in the answers, node.js proxies use an older spec. I can use a shim like https://github.com/tvcutsem/harmony-reflect to work around this, but this still requires the --harmony flag to enable the underlying proxy support, and I want to know whether it's possible to enable that at runtime in a process started without the --harmony flags.

4

2 回答 2

3

Proxy 的版本取决于您使用的是master还是v0.10. 最新的 stable ( v0.10) 使用3.14分支,而 development ( master) 保留在 v8bleeding_edge中(当前位于3.20)。所以更正确的问题是,“v8 实现了哪个版本的代理?”

代理实现的工作正在进行中,但它现在是一个移动的目标。在错误跟踪器 ( http://code.google.com/p/v8/issues/detail?id=1543 )中引用代理实现票证,看起来新一轮的变化即将到来。所以要小心即将到来的发展。

至于在应用程序而不是命令行中启用代理,我相信您必须编写一个本机模块并使用该V8::SetFlagsFromString方法(https://github.com/v8/v8/blob/f281162/include/v8.h #L4341-L4344)。如果你需要一个例子,我可能会抽出时间来做一个。

于 2013-07-01T05:57:28.433 回答
2

Node.js 实现了较旧的代理规范。不要使用它们。

https://groups.google.com/forum/?fromgroups=#!topic/nodejs/LPD8ut33-hg

于 2013-06-30T21:06:23.440 回答