i often find myself needing something like precondition(_:_:file:line:) that prints the message on release builds. but fatalError(_:file:line:) is a bit too heavyweight because instead of
precondition(x === y, "object does not match")
it turns into
guard x === y
else
{
fatalError("unreachable: object does not match")
}
why can’t precondition(_:_:file:line:) just print the message in release builds?
My understanding is that this is one of the main advantages to using preconditionFailure over fatalError -- not having to log out a message is not only slightly better for performance and binary size, but also more secure since it means your file names don't end up in the binary.