I would say that it's not intuitive way of doing things. Let's simplify it and say that you just redefine new
. Then in some point you do A new
and get an instance of B
. The thing that they are similar makes it not so bad. But imagine that someone else starts working with your code. And hew knows that message new
should result in creation of the instance of the receiver. And then something goes different. I'd say that conceptually it's wrong. Why now to implements some builder class? And have there something like
createInstanceOfAB
|className|
className := "do what you need".
^ className asClass new.
This is a more clear way.
Once again you can make new…
method to do whatever you want, even shoot fireworks, but most of the people will expect it to create instance of the same class