News for hackers. Stuff that matters.
Re:Common Lisp Object System (CLOS) by rosebay on Wednesday November 23, 2022 @07:37AM (#33718418)
Agreed. I program in CL and other languages too. I find Java developers tend to have a stronger understanding of OOP and that might be behind your insight. For all its benefits, it feels like at times many CL users miss the point of OOP.

CLOS itself is great, however the decoupling of data and methods is something at times I find leads to harder to understand code.

Re:Common Lisp Object System (CLOS) by aidenn0 on Wednesday November 23, 2022 @09:58AM (#33719887)
> CLOS itself is great, however the decoupling of data and methods is something at times I find leads to harder to understand code.

I think that might be familiarity rather than anything fundamental. I often find the coupling of data and methods to lead to harder to understand code; if I want to define a new method on an object in Java, I have to either subclass it or modify the class itself. Even if the method is ancillary to the core functionality of the class. That seems strange to me.

Re:Common Lisp Object System (CLOS) by andrekandre on Wednesday November 23, 2022 @07:01PM (#33726131)

  > I want to define a new method on an object in Java, I have to either subclass it or modify the class itself.
maybe what you are looking for is extension methods?

objective-c/swift/kotlin/c# all support them to varying degrees (but sadly not java afaik)

Re:Common Lisp Object System (CLOS) by aidenn0 on Wednesday November 23, 2022 @07:42PM (#33726474)
Yes, those are a huge improvement over the Java/C++ way. I cant tell if in a typical implementation all extension methods share the same namespace though (i.e. if the language has the concept of a "namespace" can one safely define two different extension methods on the same object in two different namespaces; this is trivial in CLOS since methods are not namesepaced to objects in any manner).

A quick read of the wikipedia article makes it look like in C# you can do this, but not in Ruby.