Hacker News new | comments | show | ask | jobs | submit login

> object oriented programming in elisp is just part of a standard library you can import.

This is how OO is done in Common Lisp (CLOS is the standard here) and Scheme (no standard object system, but every so often someone writes one for themselves).




My (perhaps limited) understanding is that in CL everything, including integers and similar basic types, is an object - nothing has to be boxed or unboxed, nor does one necessarily need to instantiate objects in order to use them. That's not to say that there are not objects similar to those of Blub made available through CLOS, only that as is typical, Lisp muddies the waters when using terms like "object oriented." $$

$$ Reading Let Over Lambda is what done it to me.


No, I don't think so. Behind the slightly odd syntax CLOS is a very traditional OOP system. In my example in the article there's even type checking in the method:

(defmethod some-user-greeting ((user some-userc) &optional daytime) ....)

means that the argument 'user' to the method MUST be an object of class 'some-userc'.

EmacsLisp's CLOS doesn't have as much type checking as CL's but it is there.


> in CL everything, including integers and similar basic types, is an object - nothing has to be boxed or unboxed, nor does one necessarily need to instantiate objects in order to use them.

This is what CL people say, certainly; what you think of this statement (true? useful? a bad definition of 'object'?) depends entirely on what you think an 'object' is.

If you're a Smalltalker (or a Java programmer, or a C++ programmer, or a user of any language that got its object system from Smalltalk), then an object is something that can respond to messages. CLOS doesn't work like this: There are no messages, and expressions don't contain objects privileged to be the recipient of the message being used; therefore, a Smalltalker might well say that while CLOS has inheritance and polymorphism, it doesn't have objects as such.

(And, off in the corner, some C programmers are insisting that an int is a perfectly good object.)


I think that argument is nonsensical (it's covered well on the CL wiki btw - http://c2.com/cgi/wiki?HowObjectOrientedIsClos ). CLOS clearly has messages (which are implemented with methods).




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: