|
|
|
|
|
by fixermark
3899 days ago
|
|
It's one of those features that seems mad until and unless one runs into the situation that justifies it. Go provides default values to avoid the C error-factory of random undefined behavior resulting from re-use of whatever is in a memory address; that much is clear. But the reason Go lets you partially instantiate an object (and separates out construction from state) is to make it easier to write unit tests, where the common case is that you want to circumvent the "main line" object construction pathways. |
|