Skip to main content
6 events
when toggle format what by license comment
Dec 8, 2023 at 18:03 comment added user949300 Given that OP presented source code, not binary, and is confused by the subtleties of the existing constructors, let's agree to disagree on this one. :-)
Dec 7, 2023 at 21:22 comment added Doc Brown @user949300: think of your and the OPs solution both compiled to binaries, where only the signature is visible to the user of a class, but not the implementation. In the OPs design, it will be clear that only one kind of initialization is possible, at compile time - no comment needed. For your solution, the user of a class needs a clear comment in the API documentation that they are only allowed to pass one of both objects. So I would say your solution introduces the need for a comment, where the OPs solution does not have this need.
Dec 7, 2023 at 20:16 comment added user949300 I don't disagree enough to downvote, and you make valid points. However, I'd argue that my solution eliminates the need for comments (which often are overlooked) and unit tests (which take effort and sometimes fall behind)
Dec 6, 2023 at 19:40 history edited Doc Brown CC BY-SA 4.0
added 80 characters in body
Dec 6, 2023 at 17:24 history edited Doc Brown CC BY-SA 4.0
added 519 characters in body
Dec 6, 2023 at 16:26 history answered Doc Brown CC BY-SA 4.0