Hacker News new | ask | show | jobs
by palish 6937 days ago
Except you can't have just functions, because then you end up with a semi-object system anyway. For example, you might have a function "dot" which puts a period at the end of a string, and a function "dot" which returns the dot product of two vectors. The first should be a string method, and the second should be a vector method. Without an object system, you'd call it dot-string and dot-vector, which is okay, but semi-object-oriented. Lisp has something that specializes functions based on its first argument.. That might be useful for that.
2 comments

CL's generic functions are a bit more sophisticated than just specializing based on the first argument. Peter Seibel's book has a good chapter on them: http://gigamonkeys.com/book/object-reorientation-generic-functions.html
I disagree. A language without OO can allow code to be organised in an intelligent way by providing a module system. See Standard ML as (what I consider to be) a good example of this.
i agree. i'm using a module system myself and it's way better than OO
How can it be better, it seems to me that a module system would be a subset of an OO system? So logically it can't be better, if you are not forced to use all features of the system.