Re: [PATCH RFC3.5 08/12] send-email: Move Subject sanitization from --compose code to send_message
- From
Michael Witten <mfwitten@gmail.com>
- Date
- Apr 19, 2009, 14:53 UTC
- Message-ID
- <b4087cc50904190753v6f5862c0sebe2dcc56c5269dc@mail.gmail.com>
- In-Reply-To
- <b4087cc50904190739u54a9a9d7p6f011ab2b47c1d05@mail.gmail.com>
On Sun, Apr 19, 2009 at 09:39, Michael Witten <mfwitten@gmail.com> wrote:
Show 16 quoted lines
> I'm morally opposed to this kind of thing. The caller should be > required to test whether quote_rfc2047() is required, as it's not the > job of quote_rfc2047 to validate. Suppose that quote_rfc2047 were > actually part of a library of useful functions that my program > imports. Perhaps my program knows that it must always quote some piece > of text. Why, then, should my program be forced to waste the cycles to > perform a useless test? > > IMnsHO, verification should always be done by the caller with one > exception: Interactive (human) input should always be verified, > because humans represent an unreliable component in the system (in > terms of digital systems, their asynchronous input must be > synchronized with the clocked system). WIth this model, there's are > fewer wasted cycles, because you can reuse verification across similar > functions, and the code (particularly library code) is easier to > understand.
I should add, though, that making the logic of the program clear is a good idea. In that sense, your approach makes sense. Since we 'own' quote_rfc2047(), I'd say we could take your approach, but rename the function to something like quote_rfc2047_if_necessary(). If quote_rfc2047() were part of a library, I think the only moral solution would be to insist that callers wrap it in another function named quote_rfc2047_if_necessary().