Well put. I often see people who are not depressed who use optimism towards depressed people, because optimism will cancel out an ephemeral despondency as it doesn’t really require evidence or reasoning beyond “it’ll get better”. Depression is too well bunkered in for something like that.
Optimism provides a useful safeguard against depression in the first place. It's called the optimism bias. If people think too realistically (or, perhaps it's better to say glumly because it may still not be realistic even if more realistic) without regular doses of optimism that realism may turn into longer periods of despondency, and we know where that leads.
As I recall, around 80% of people have the optimism bias. The rest are prone to depression.
What is the difference?