TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Common Lisp Object System (CLOS)

113 pointsby memorableover 2 years ago

12 comments

bcrosby95over 2 years ago
I&#x27;ve been exploring CLOS for the past couple of weeks.<p>From what I can tell, it seems especially nice for a system that needs extreme flexibility. I like to program MUDs and rougelikes as side projects, and after initial exploration, CLOS seems perfect for that - it can enable certain interactions that I would otherwise have to spend a lot of work and design achieving in other languages. It turns what feels like a chore in other languages into something fun.<p>I would imagine that how much this is a pro or con depends upon the work you do. Some might see such potential flexibility as error prone and overly complex because the domains they work in don&#x27;t require such complexity. But others might see it as the building blocks for a domain with complex interactions that they have to build regardless of the language they use.
评论 #33724603 未加载
评论 #33721434 未加载
bradrnover 2 years ago
Alan Kay’s immortal quote about OOP:<p>&gt; OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I&#x27;m not aware of them.<p>[<a href="http:&#x2F;&#x2F;userpage.fu-berlin.de&#x2F;~ram&#x2F;pub&#x2F;pub_jf47ht81Ht&#x2F;doc_kay_oop_en" rel="nofollow">http:&#x2F;&#x2F;userpage.fu-berlin.de&#x2F;~ram&#x2F;pub&#x2F;pub_jf47ht81Ht&#x2F;doc_kay...</a>]<p>His reference to ‘LISP’ is, of course, referring to CLOS.
评论 #33721613 未加载
评论 #33722550 未加载
评论 #33718256 未加载
评论 #33718497 未加载
评论 #33718901 未加载
评论 #33726361 未加载
ynnivover 2 years ago
<p><pre><code> I don’t know the exact implementation details of CLOS, but I feel that it can be easily replicated in C by adding the needed metadata in the structure and doing the needed type checking in the functions. </code></pre> And thus Objective-C was reborn
评论 #33725885 未加载
评论 #33731548 未加载
medo-bearover 2 years ago
isnt this just a small journal entry saying, &quot;i started to learn clos and i think i like it&quot;. i dont see any siginificant information about why clos is great here. doing general oop in lisp is powerful from the get-go because you can update classes and instances interactively. you will use clos for this basic functionality. however clos also allows you to extend the oop ideas in directions that are just not available in other languages
dj_mc_merlinover 2 years ago
Meh.. I code in Common Lisp at home and Java professionally and I&#x27;ve never understood why people praise the CLOS so much. Like the author says, 99% of the time you don&#x27;t have a reason to use OOP, and the few times you do you&#x27;d prefer to use as little as possible to keep everything sane. It&#x27;s also one of the few parts of CL which are not optimized well by default, using structs or other basic data structures instead of objects has visible performance benefits in SBCL if you care about that for some reason.<p>Yes I&#x27;m aware of the things you get in CL you don&#x27;t get in Java: multiple inheritance, defmethod works on arbitrary types by default rather than having to create interfaces, better introspection.. but I don&#x27;t care. If you&#x27;re using these features so much there&#x27;s probably something overly complex with your code to need to do so. Or you&#x27;re working in such a complex domain you need to, in which case go ahead..
评论 #33718985 未加载
评论 #33720043 未加载
评论 #33718870 未加载
评论 #33723379 未加载
评论 #33720984 未加载
评论 #33718418 未加载
评论 #33721266 未加载
评论 #33718883 未加载
评论 #33718661 未加载
评论 #33718865 未加载
评论 #33718890 未加载
EdwardCoffinover 2 years ago
&gt; I don’t know the exact implementation details of CLOS, but I feel that it can be easily replicated in C<p>This makes me think he&#x27;s barely scratched the surface of what CLOS has to offer.
评论 #33718655 未加载
评论 #33718565 未加载
评论 #33718229 未加载
评论 #33725282 未加载
gjvcover 2 years ago
The definitive book on implementing CLOS (not how to use it) is <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;The_Art_of_the_Metaobject_Protocol" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;The_Art_of_the_Metaobject_Prot...</a>
评论 #33718326 未加载
retrocryptidover 2 years ago
If you like CLOS, be sure to look up &quot;The Art of the Meta-Object Protocol.&quot; It Was written by people who were at PARC back in the day so were on the ground when Smalltalkish concepts were being developed and extended. But... it&#x27;s focused on Lisp.<p>It describes the thinking behind an implementation of OOP for Lisp, and along the process reveals parts of the mental journey to both Smalltalk and CLOS.<p><a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;The_Art_of_the_Metaobject_Protocol" rel="nofollow">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;The_Art_of_the_Metaobject_Pr...</a>
评论 #33721043 未加载
ilyashover 2 years ago
OOP implementation in Next Generation Shell was inspired by CLOS but it&#x27;s way simpler.<p>Defining a type: type MyType.<p>At any point one can declare method: F myMethod(..., mt:MyType, ...) some_code()<p>Anything defined by F is automatically a multimethod. When invoked, all methods in the multimethod are searched bottom up. The first one where the call arguments match the parameters (by type, with inheritance) is invoked.<p>That&#x27;s roughly it.
timonokoover 2 years ago
One thing bad is the word &#x27;class&#x27;. What it is supposed to even mean? It was some fancy concept by stupid Normen when defining Simula. My Simula teacher said that you could just translate it as &quot;design&quot; as in &quot;design of car and its implementation&quot;.<p>Anyways Python&#x27;s &quot;class&quot; is even worse:<p><pre><code> class c: a=10 print c.a c.a=13 print c.a </code></pre> I cannot think any English word to replace the &quot;class&quot;. The word I am thinking of could be translated as &quot;box&quot;. &quot;Box of things and improved versions of it&quot;.
评论 #33721062 未加载
评论 #33721049 未加载
评论 #33718852 未加载
评论 #33718774 未加载
评论 #33718540 未加载
评论 #33719825 未加载
评论 #33718518 未加载
PeterStuerover 2 years ago
!00% agree at the basic level. The approach here with multiple dispactch to me feels so much more natural than the Smalltalk&#x2F;Java type of OO.
0x445442over 2 years ago
&gt; Instead of instructions like in imperative programming (and modularizing it with functions), your program is a set of entities talking to each other and collectively achieving the required goal.<p>So it looks like the author discovered a key characteristic of OOP which many languages including Java, support.