DEV Community

Discussion on: Functional design: smart constructors

Collapse
 
qm3ster profile image
Mihail Malo

Interesting, never thought about returning Option for a "constructor" instead of throwing.
It makes perfect sense, but I was too used to throwing being the default option in real (new keyword) constructors that I extended that to everything, even primitives wrapped in newtypes.