My first exposure to Robin Williams must have been when I was about 9, when one of the local TV stations started airing daily reruns of Mork & Mindy. As a budding young comedy nerd who'd discovered MAD Magazine a year earlier and watched every funny thing he could find, I was thrilled by Williams' energized performance. It was one of the funniest shows I'd ever seen. Did I walk around for weeks imitating Mork and annoying my family? You better believe it.

The Dr. Demento Show introduced me to Williams' 1979 stand-up album, Reality... What a Concept, and then to his 1986 show A Night at the Met, in which he spoke frankly (and hilariously) about his struggles with drug addiction and other demons. By this time, I was starting to become aware of the cruel irony that many comedians live sad, painful lives. Even though I wanted to be a comedy writer myself, I didn't see yet how this might apply to me.

Williams was an inspiration throughout the '80s and '90s, particularly when he'd appear on talk shows. While I admit I later tired of his free-floating, improvised mania (saying everything really fast doesn't make it funny), at the time he was dazzling, an inspiration to me and my high school buddies who also fancied ourselves improv comics. I was so struck by his now legendary performance in Aladdin that I saw the film a dozen times in the first six months of its release.

It wasn't until I was in my late 20s that I realized the mood swings, irritability, and hyper-sensitivity I'd experienced since adolescence were symptoms of a larger, treatable problem: clinical depression. I was prescribed medication that made me more even-keeled than I'd ever been. It worked for six years, until August 2009, when it stopped suddenly and I fell into a severe, life-threatening depression. New meds were found, changes were made, and things got better, but not before a few weeks of unmitigated hell.

Williams spoke candidly about his struggles with drug and alcohol addiction, notably on that famous 2010 episode of Marc Maron's WTF podcast. "When I was drinking there was only one time where even for a moment I thought, 'Fuck life,'" he said, adding that he never considered suicide again. He didn't talk as much about the depression that led to or resulted from that addiction (or bothit's a vicious cycle). But you could see evidence of it in his work, as Vulture writer Bilge Ebiri noted in a much-retweeted observation on Monday: "You start off as a kid seeing Robin Williams as a funny man. You come of age realizing many of his roles are about keeping darkness at bay."

In films like The Fisher King, Good Will Hunting, and Patch Adams, he played damaged, grieving men who masked their sorrow with humorous, even manic, behavior. That was often true in his full-on comedies, too. In Mrs. Doubtfire, he did something silly (dress as an old woman) to achieve something intensely serious (be close to his children). Even Aladdin was about a zany whirlwind of a clown who aims to please with funny voices and rampant silliness (Williams to a tee) but who secretly harbors a sad, serious desire: to be free. To not HAVE to perform anymore if he doesn't feel like it.

Williams was a beloved entertainer described by those who knew him as a kind, generous soul. No matter how many bad movies he made (and he made his share, boy howdy), they somehow never reflected poorly on him. That's how great he was. His death on Monday at the age of 63 would have been a blow however it came.

But the manner of it—alleged suicide as the result of severe depression—hit me in the gut in a "there but for the grace of God go I" sort of way. Even now, five years later, recalling the lowest days of my depression (unequivocally the worst time of my life) rips me apart, the mere memory of it enough to produce a shudder. And yet I didn't have it as bad, or for as long, as Williams did. Remembering how awful it was and realizing it could have been worse makes me weep with sadness and gratitude.

I don't have a fraction of Williams' talent (this should be obvious), but I've often done what he and other depressed humorists do all the time. I've cried in despair, then thought of a joke. I've felt like I'd fallen into a black pit, then sat down to write a song parody. I've experienced unprovoked, irrational misery, then gone onstage with an improv troupe. I've turned personal tragedy, pain, and misfortune into comedy.

Maybe it's selfish, but knowing Williams suffered from depression made me feel a kinship with him, like we were members of the same big, sad club. I empathize with his pain and admire the laughter he covered it with. And I'm so, so sorry he couldn't take it anymore.

Eric Snider is a contributing writer and film critic. He tweets here.