When loading controllers, services etc., the classes are instantiated, but then the instance will receive its own set of functions defined on the prototype which are bound to that particular instance. This is done here.
Is this really necessary?
I think I understand the intention here (avoid issues when those functions are called without context), but I would like to challenge the decision to support this kind of practice. To me, if someone tries to grab a method from a class instance, call it without its context (this) and expect it to just work, they are doing it wrong.
If my understanding is correct, the decision to use classes for controllers, models, services etc. has been quite recent so this might just be a remnant of some now-obsolete practice.
I would really love to get rid of this. :) Will you accept A PR that removes such functionality and instead just creates a new instances of all the things?
When loading controllers, services etc., the classes are instantiated, but then the instance will receive its own set of functions defined on the prototype which are bound to that particular instance. This is done here.
Is this really necessary?
I think I understand the intention here (avoid issues when those functions are called without context), but I would like to challenge the decision to support this kind of practice. To me, if someone tries to grab a method from a class instance, call it without its context (
this) and expect it to just work, they are doing it wrong.If my understanding is correct, the decision to use classes for controllers, models, services etc. has been quite recent so this might just be a remnant of some now-obsolete practice.
I would really love to get rid of this. :) Will you accept A PR that removes such functionality and instead just creates a new instances of all the things?