|
|
|
|
|
by lock1
328 days ago
|
|
I find regular OOP language constructor are too restrictive. You can't return something like Result<CorrectObject,ConstructorError> to handle the error gracefully or return a specific subtype; you need a static factory method to do something more than guaranteed successful construction w/o exception. Does this count as a missing language feature by requiring a "factory pattern" to achieve that? |
|
Convention in OOP languages is (un?)fortunately to just throw an exception though.