12 ms·
I learned Common Lisp and "enough" CLOS in high school, was blown away by CLOS's power†, and have spent the entirety of my professional career wishing that I co
by tsm 8y ago
I learned Common Lisp and "enough" CLOS in high school, was blown away by CLOS's power†, and have spent the entirety of my professional career wishing that I could have a job working on a complex system in CL that used all of CLOS's interesting features. This has not happened (I've been 80% in Ruby-land and 20% doing Clojure), but what's weird is that I haven't even had situations where I really yearned for AOP, multi-methods, the MOP, etc. I can't decide if the systems I've worked in have just been too boring (they certainly solved the business problem though) or if Ruby's object-orientation (and library ecosystem) is good enough that I just don't need the full power of CLOS. (Designing Clojure programs is a totally separate kettle of fish.) I'd be interested to hear from more seasoned Lispers about their experience with CLOS in production.
† I took an FP class during my first semester of college. The professor wrote the book himself, and had an extended sidebar comparing the design considerations of OO systems (easy to add another class; tedious to reopen n subclasses to add another method to each one) and FP systems (easy to add another function dispatching on type; tedious to reopen n functions and make them dispatch on a new type). I pointed out that CLOS handled both situations equally well, and in the final edition of the book he tossed in a footnote saying as much and thanking me.
- smnplk 8y ago>> I pointed out that CLOS handled both situations equally well, and in the final edition of the book he tossed in a footnote saying as much and thanking me. << Clojure's multimethods and protocols also solve both.
- emit_time 8y agoThis is ironic, the job I have an interview for tomorrow uses a CLOS database, and apparently the whole backend is Common Lisp.
- aidenn0 8y agoWhich database? I'm interested to know what is used in commercial endeavors, since there are a lot of toy object stores littering the software graveyards.
- deleted 8y ago[deleted]
- ken 8y agoNot sure how "seasoned" I am, as the biggest program I've written in CLOS that went live was under 2000 LOC, which doesn't sound like much. In other languages, though, it would have been much longer, due to two factors. One is that CL seems to encourage writing everything in CL, so it's easy for library authors to expose everything (like their intermediate AST) to callers. That helps reduce redundancy. In other languages, what I often need is something that's already computed internally, but not exposed in any interface, so I have to build it myself again. A surprisingly common case is a Python or Ruby library where they wrapped a C library to get good performance, and I need data in a C struct that they didn't think anyone would need. Two is that CL, more than any other language, makes not just for concise code, but for concise diffs. (This is what you mention in your footnote, but I think it's true in general, not just with CLOS methods.) Whenever I wanted to make a change which I could describe briefly in English, it always ended up being something which I could implement in a similarly brief changeset. Other HLLs can usually, IME, be just as concise for a given solution, but the nearby solutions in the problem space might require a completely different design. This is where the full power of CL helped me. If you know exactly what you want from the start, then you can implement it easily enough in almost any language. If you change your mind halfway through, the weird features available in that "full power" (CLOS dispatch, macros, special vars, etc) makes it possible to avoid rearchitecting the whole thing. (Then you have the choice to gradually refactor to avoid the need for them, or just leave it.) Despite all the new programming languages in the past ~30 years, I haven't seen any which made diff size a design priority. I think even Clojure isn't quite as good at this, though I'm still a newbie in that language.