A passage from Heinlein's Stranger in a Strange Land:
"I've found out why people laugh. They laugh because it hurts... because it's the only thin that'll make it stop hurting.
... The things that do happen on Mars which we laugh at here on Earth aren't funny because there is no wrongness about them. Death, for example."
"Death isn't funny."
"Then why are there so many jokes about death? Jill, with us - us humans - death is so sad that we must laugh at it. All those religions - they contradict each other on every other point but each one is filled with ways to help people be brave enough to laugh even though they knew they are dying."
There's a lot of truth to this. Certainly all slapstick humor is based on this principle. Every pie in the face, every social gaffe, everything with a laugh track, is based on someone getting fooled, hurt, embarrassed, or humiliated. Laughter distances us from empathizing with a situation that would otherwise be unbearable. (As an aside, I have a violent dislike for most slapstick humor. "As Good As It Gets" had me seriously fucked in the head. I walked out of "The Waterboy" and flat out refused to see "There's Something About Mary".)
But Heinlein (in the voice of Valentine Michael Smith) maintains that *all* humor is based on pain. He is careful to make the distinction between humor and joy - the laughter brought on by a beautiful spring day, or by rolling down sand dunes, is not what he's talking about. "A belly laugh, not a smile," he says.
As eloquently as he puts this, I don't agree. What about the laughter that comes from things like Anguish Languish? Or from seeing silly shapes in the clouds? Or the chance juxtaposition of movie titles on a theater marquee ("What A Girl Wants: Anger Management")? The first time I heard "Ladle Rat Rotten Hut" I was rolling on the floor. Where's the pain there?