Terminal illness can't really be hidden and does affect your spouse and family.
A better analogy is infidelity. You shouldn't tell a partner if you've been unfaithful because it benefits no one. I think this quite by the Australian author Bettina Arndt says it best:
"That's the amazing thing. So many people end up confessing to an affair, which strikes me as the ultimate stupidity. Sure, you may believe you are confessing all to preserve honesty in your marriage, or because he/she deserved the truth, but the reality is that this 'telling' business is all about people not having the backbone to live with their guilt. Telling doesn't right the wrong; it adds to it."
(The Sex Diaries / Bettina Arndt)