5 ms·
> No need for metaclasses simply to make the class construction locals dict an ordered dict. ORM library devs will be happy. understatement with that. Saw some
by RubyPinch 10y ago
> No need for metaclasses simply to make the class construction locals dict an ordered dict. ORM library devs will be happy.
understatement with that. Saw someone trying to avoid using a metaclass for that, "had" to use descriptor objects which all used the same global counter to work out their order
- carapace 10y agoHey, guess what? Just don't use metaclasses. At all, for anything. Done. GvR called it "The Killing Joke" for a reason. This is a clear case of "negative productivity": People are working "harder than a cat trying to bury a turd on a marble floor" to pee in my soup. It makes me grumpy.
- RubyPinch 10y agowhat, not using metaclasses in that case caused more "issues" than would of been caused by using metaclasses multiple global values to track state, since can't bind the state to the class' creation, since the conversion to the final form of the class happened after its creation, vs being able to bind the state to the class' creation, since the conversion happens as the class is created
- carapace 10y agoKnowing nothing more about this codebase than the above, I would fire everyone and make the CEO's nephew write it. It could hardly turn out worse and it would be a lot cheaper. (I'm joking, but only barely.)
- RubyPinch 10y agoThe reduced usecase (story?) is the following The customer requests the following @? class somename (?): an_attr_a = ADescriptor(somestuff) an_attr_1 = ADescriptor(somestuff) an_attr_a1 = ADescriptor(somestuff) One of their expectations is that the attributes have their definition order stored somewhere. You may either use the decorator method, or the metaclass method