4 ms·
Completely agreed, the title is a red herring and serves to dissuade people from giving DCI a try. "It's too slow" is not an argument against DCI, it's an argum
by latortuga 14y ago
Completely agreed, the title is a red herring and serves to dissuade people from giving DCI a try. "It's too slow" is not an argument against DCI, it's an argument for fixing a slow implementation of #extend or using a different method.
- bascule 14y agoWhy not do DCI with delegation instead of mixins?
- davnola 14y agoBecause in general, delegation tends to lead to object schizophrenia. Specifically, SimpleDelegator will leak the original delegatee object when a delegated method returns `self`. s = "foo" d = SimpleDelegator.new s s2 = d << "bar" s2.object_id == s # true I think SimpleDelegator is really neat but totally dangerous. Doesn't this ring alarm bells with you? # delegate.rb L117 # # Returns true if two objects are considered of equal value. # def ==(obj) return true if obj.equal?(self) self.__getobj__ == obj end