=begin
When a class is created using ((|class|)) keyword, Class.new is not called but if class is created using ((|Class.new|)) it is obviously called, there seems to be a dyssymmetry between ((|class X|)) and ((|Class.new|)) e.g.
class Class
class << self
alias new_orig new
def new(*args)
obj = new_orig *args
print "created",obj,"\n"
obj
end
end
end
class X
end
Note that if you need to detect class creation, that can be done using the inherited callback.
I don't want to detect class creation I wan to overload new, which should be possible, at-least it would be elegant if class X and 'Class.new` behave similarly
new' is one of the ways to create an object, and most obvious probably, but not the only way. For examples, string interpolation, File#open, Thread#start, and many. class' statement is just one of them.
I don't want to detect class creation I wan to overload new, which should be possible, at-least it would be elegant if class X and 'Class.new` behave similarly
I think partial overloading can be done by defining the initialize private method.