Node.js - 重载函数

发布于 2024-09-25 16:16:09 字数 185 浏览 0 评论 0原文

有没有办法重载node.js中的函数,类似于 __noSuchMethod__?

Is there a way to overload functions in node.js similar to __noSuchMethod__ ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瀞厅☆埖开 2024-10-02 16:16:09

就像 bxjx 简要提到的那样,Node.js 基于 Google 的 V8 javascript 引擎,这意味着任何语言的构造或功能都来自于此。鉴于它是非标准的,我认为他们不会在不久的将来添加它。另外,我不认为 N​​ode 会基于非官方的 V8 分支,但谁知道呢。您仍然可以自己使用那把叉子。

Like bxjx briefly mentioned, Node.js is based on Google's V8 javascript engine, meaning that any language constructs or features come from that. Seeing as it is non-standard, i don't think they will add it in the near future. Also i don't think Node will ever base itself on a non-official V8 fork, but who knows. You can still use that fork yourself.

芯好空 2024-10-02 16:16:09

那会很酷。它将开放类似于 ruby​​ 中的 DSL 功能。

根据node.js google 论坛上的此对话,这可能不会发生。如果没有 object.send('method') 我想不出另一种方法,但也许这是可能的。

看起来人们已经分叉了 V8 来添加这种东西

That would be cool. It would open up DSL like capabilities found in ruby.

According to this conversation on the node.js google group, it's probably not going to happen. I can't think of another way around it without object.send('method'), but maybe it's possible.

Looks like people have forked V8 to add this sort of thing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文