简体   繁体   中英

node.js - overloading functions

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

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM