Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Constructors are stupid and violate one of the principle ideas behind OO which is separation of concerns.

What initializes a data structure should not care how the data structure was allocated. It's two functions one () -> T and T -> T allow them to be first class citizens.

If you want to combine them use a static method that simply invokes the initializer after the allocator (which is how it works anyway, and how new is implemented in both Ruby and Obj-C). And it's not like it solves any real problems as it's perfectly alright to have uninitialized and incorrectly initialized objects with current constructors.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: