| ▲ | moron4hire 2 days ago | |||||||
In JavaScript, one can tell if an object has a method by iterating over the object keys and seeing if the value is `instanceof Function`. But that actually tells you very little. You might be able to tell that it takes a certain number of parameters, if you are running on a system that implements Function.prototype.length. But you will have no way of telling what the arguments to those parameters should be, or even what they were even named. There's no way to tell if the function is a method that needs to be `.call()`ed with a value for "this", or if it's just a function that happens to live in an object literal, or if it's actually a class constructor that must be called with `new`! And there is certainly no way to tell whether the function returns a value, say nothing about the type of value it returns. With .NET reflection, I can do ask those things I lament missing in JS, and guarantee the type safeness of it. | ||||||||
| ▲ | matheusmoreira 2 days ago | parent [-] | |||||||
Isn't this just a fundamental limitation of dynamic typing? | ||||||||
| ||||||||