Re:Why Java Sucks – Jonathan Gardner
by jdbernard on Monday December 19, 2016 @06:53PM
(#13216110)
Works just fine if you change:
to
Of course, since this is a made-up example to highlight one of your pet problems I don't know if that ordering is important to you. However there is a reason for the insistence on calls to the constructor being first, and it's not specific to Java. You run into this problem any time you have code that might mutate a data structure before if has been initialized. There are other ways to write this kind of code that avoids this, but it is by no means unusual in imperative code.
[ Parent
| on HN ]
There are no comments on this comment yet.