Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you don't think Ruby's is good, what language does have a good object system? I mean, it essentially plagiarized Smalltalk, which has the best fundamental object system I know of — and added mixins, which complement traditional inheritance very well.

(Yes, its imitation of Smalltalk has a few seams showing — like the fact that blocks are not normally objects — but overall it's a pretty good if imperfect system. I certainly don't know of any language that gets closer.)



Ruby does have an advantage (thanks to its Smalltalk influence) of treating most primitives as objects in a much less clunky form than Python. That allows for many useful abstractions.

CLOS, Smalltalk, Perl 6, and Perl 5 with Moose have better object systems. Mixins suffer similar method resolution flaws to multiple inheritance, and the same problems with unconstrained monkeypatching show themselves with unconstrained duck typing in large systems.


How are the other systems better? I've bumped up into enough rough edges with Ruby to have a pretty good idea of where its seams are showing, but I've had to write a fair amount of code to get there and I don't have nearly the experience with the others to spot how they might work around the same design problems.


CLOS and Perl 6 have multiple dispatch, which improves genericity when used well. All four of the languages I mentioned have better metaprogramming capabilities, whether from runtime introspection in Smalltalk to a well-defined MOP in the other three. Smalltalk and both Perls offer better mechanisms for genericity, abstraction, and safety through traits and roles.


I mean, the obvious answer is CLOS, but a lot of people don't think that CLOS is an object system.

(To mean that it is very much different from smalltalk/ruby/java paradigm of single inheritance, encapsulation, and message passing).


I wonder if people think "CLOS is not an object system" because of its pervasive support for multiple dispatch.




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

Search: