4 ms·
It's more consistent (no wondering what's a method and what's not for most common situations) and it stops the global namespace getting littered up with functio
by petercooper 15y ago
It's more consistent (no wondering what's a method and what's not for most common situations) and it stops the global namespace getting littered up with functions that are only relevant to certain types.
To a Rubyist, knowing that Ruby is an object oriented language, it is clear one is sending a message to i. With the latter example, it is not clear what even? belongs to and what it expects to receive.
- Locke1689 15y agoThen namespace it. As I said, there's nothing stopping you from having namespaces and modules. import Arithmetic (even) even :: Integer -> Bool even i Also, you can call function calls messages or object operations or dictionary lookups, but I don't see the benefit in 99% of cases. I guess the dynamism may be useful in GUI code where it's not that hard to see if you're wrong and if you are wrong, nobody's world really ends. In most other cases functions are best described as having a formal mathematical definition so you can reason about them with some accuracy.