Hacker News new | past | comments | ask | show | jobs | submit login
A Brief Guide to the Common Lisp Object System (ed.ac.uk)
72 points by wtbob on April 10, 2015 | hide | past | favorite | 9 comments



Starting from classes and describing generic functions as a way to send messages is pretty backwards for CLOS.

CLOS is best used primarily by defining a protocol with generic functions, then using methods and (optionally) classes to implement the protocol.

http://xach.com/lisp/jrm-clos-guide.html has a copy of Joe Marshall's "Warp Speed" CLOS guide.


For more on CLOS, "Object-Oriented Programming in Common Lisp" is a fun little book. It has some reasonably practical examples and touches on just enough of the system's low-level details. It doesn't have much to say on the Metaobject Protocol, though, and I think for that "The Art of the Metaobject Protocol" is pretty much the standard text.


Agreed on both recommendations. It's a pity that further standardisation stalled; the MOP would make a good addition.


And that the ideas of 'self-extensibilty' & intersession haven't been further developed. IIUC one can change a class metaclass in Pharo/Smalltalk but not in CLOS. Rhodes idea of extensible specializers seems very useful


Most current implementations support the MOP.


Seconded, both examples. I get strong impression, working with Lua, that Roberto Ierusalimschy is a devotee of the MOP. Lua in a sense has a MOP but no built-in object system.


A strongly typed version of CLOS generic functions would look a lot like Haskell typeclasses, right?


IIUC, the primary method of the standard-method-combination look's a lot like Haskell Typeclasses.

The standard-method-combination has a middleware-like dispatch as shown in here [0]. CL comes with other method-combinations like +, append and you can also define new method combinations.

[0]: https://commons.wikimedia.org/wiki/File:Method-combination.p...


Ah, I forgot about before/after/around. That makes sense, thanks!




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: