3 ms·
So basically you're saying that if you want different behavior based the type of a variable passed to a function, you're going to have to write that behavior...
by clishem 9y ago
So basically you're saying that if you want different behavior based the type of a variable passed to a function, you're going to have to write that behavior...
Then the answer is yes. We haven't advanced to the point where the compiler can guess that you want. If you can give me an actual example of when it would be an insurmountable task to do so, please let me know.
- ChrisSD 9y agoThe blog post is saying that writing that behaviour is more complex than it needs to be. The author gave an example of pattern matching syntax that would greatly simplify things.
- coldtea 9y ago>So basically you're saying that if you want different behavior based the type of a variable passed to a function, you're going to have to write that behavior... Then the answer is yes. That, and that it should be that hard, and the provided features for doing so should be better, is the entire point of the article. >We haven't advanced to the point where the compiler can guess that you want. That's not some case of magic compilers. This is just bad design. >of when it would be an insurmountable task to do so, please let me know. Whoooosh. The whole point is not that it is insurmountable, but that it's much worse than it should be.