Over.js - Elegant function overloading in JavaScript
github.com
over.js formalizes the way we write overloaded functions, so there's no more chunky switch cases and argument.length checks inside every function. What do you guys think?
github.com
/**
* Says something in the console.
*
* say(msg) - Says something once.
* say(msg, times) - Says something many times.
*/
say: Over(
function(msg$string){
console.info(msg$string);
},
function(msg$string, times$number){
for (var i = 0; i < times$number; i++) this.say(msg$string);
}
)
};