* Yukihiro Matsumoto <matz / ruby-lang.org>: > Hi, > > In message "Class.allocate callback" > on 04/03/19, Anders Engströí <aengstrom / gnejs.net> writes: > >|I want to get a callback whenever an object is created in the vm. To do >|this I have overridden 'Class.new', and it works as long as objects are >|created through Object.new. But - I also want to get callbacks when >|objects are created during unmarshalling of serialized data.. I thought >|that I could override Class.allocate to get a callback when this happens >|- but I never get the callback. >| >|Is this a bug? > > Not really a bug. Hooking every instance allocation might too slow > for the current implementation. Sometimes I have to choose > performance over flexibility. Thanks for the reply. I can understand this decision - it makes sense. It would be nice if this behaviour was documented though :) Coming from the Java world I would say that Ruby is flexible enough, even without callback-on-allocate. And - coming from the Java world it's absolutely wonderful to ask a question in a ng and get a reply from the actual author of the language in < 24 hours :) (I wonder if James Gosling frequents comp.lang.java... ;) //Anders -- /** * Anders Engströí, aengstrom / gnejs.net * ------------------------------------- * Your mind is like an umbrella. * It doesn't work unless you open it. * /Frank Zappa */