mbeckerle commented on PR #1058: URL: https://github.com/apache/daffodil/pull/1058#issuecomment-1646097976
> > So I'm ok with argCheck, preCondition, and invariant as names of different methods. But usage an invariant are sufficient I think. > > Just to clarify, do you think combining them all into a single generic name is not sufficient? Does it matter if a bug is a usage bug or an invariant breaking bug or an invalid precondition bug? > > I'm just wondering if we can simplify our lives so that every time we want to add a check for a potential bug we don't have think about what kind of check we are adding. We're simply making an assertion that some check must pass, and if at some point it doesn't then we need to investigate why. I'm opposed to collapsing these kinds of assertions to just one. I think the distinction of usage error from invariant is helpful. Making everything just an undifferentiated assert isn't an improvement. "You're using it wrong" vs. "This code only makes sense if X is true" are different thought processes. I think of argCheck and precondition as things that should be explained in the scaladoc/javadoc of a method unless they're obvious from just looking at the argCheck/precondition code. E.g., putting both argCheck(x ne null) and scaladoc saying x cannot be null is just redundant. I think of invariant as something you probably wouldn't discuss in the scaladoc/javadoc because it's not about how to use it, it's about how the software works. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
