node.js - overloading functions

我的未来我决定 提交于 2019-12-13 14:41:38

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/3811408/node-js-overloading-functions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!