Being able to add a field to a data type and having the compiler tell you everywhere you need to update the code is a huge productivity multiplier. It’s a shame when languages forego this advantage.
-
-
But there's a lot of ceremony behind using it, so in practice, the fact that the compiler doesn't fail when a new field is added ends up pervasively influencing API design. There are upsides to it, but on balance, I'd rather do without automatic default values everywhere.
-
Scala dev and I hate default params. Person sees a method is used 100x and doesnt want to update call sites / tests, so adds a default for their one case. In a few months, thing now has 5 default params and a bug where someone didn't notice a default was wrong for their call
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.