4 ms·
Ruby may seem easier to pick up than java, but it gets pretty complicated when you actually try to understand its power. Try explaining eigenclasses to some ja
by JonnieCache 15y ago
Ruby may seem easier to pick up than java, but it gets pretty complicated when you actually try to understand its power.
Try explaining eigenclasses to some java-only developers sometime.
- wycats 15y agoEvery Ruby object is an instance of a singleton class that inherits from its declared class. # o is an instance of its singleton class, # which inherits from Object o = Object.new It is like saying: class Object def self.new(*args, &block) # Class.new(Object) creates an anonymous # subclass of Object Class.new(Object).new(*args, &block) end end except with built-in language support. Instead of having to do this manually, every object gets a singleton.
- hamidpalo 15y agoI have a hard time believing that Java developers would fail to understand the concept of a singleton, the most pervasive anti-pattern in Java code.
- JonnieCache 15y agoIt isn't the same thing, despite the same name occasionally being used. It also gets a lot more complex than expanded upon in the other comment. Eg. what is the eigenclass of an eigenclass?