I recently finished listening to an audiobook recommended to me by a friend titled Man's Search for Meaning by Victor E. Frankl. The author pointed out that those who had something to look forward to after the war were more likely to survive Nazi concentration camps. The author treated his psychiatric patients using logotherapy in which patients are led to find their own reasons to live.
I like the idea that optimism helps you survive. I agree with the author that people need to have some reason to get out of bed in the morning beyond the primitive drives of hunger, thirst, and caffeine addiction. I also agree that it can help in cases of functional paralysis due to crippling fears of personal mortality.
To one patient who was depressed because he could not have children, the author pointed out that life on its own must have meaning beyond mere propagation. When I think of one of my favorite movies Children of Men, I wonder if that is true. I think a better suggestion for the patient might have been to adopt.
Another point on which I disagree with the author is his promotion of any reason for living when a patient is suicidal, whether it is true or not, so long as the patient will accept it. For example, he lied to one patient by telling him that his current suffering would be rewarded in the afterlife. I think finding some meaning based in reality is important and to do otherwise is likely to have negative long-term consequences.
The author pointed out that staying alive long enough to find a meaning of life in the future can become a sufficient meaning itself. I think this works on the level of our species as a whole. While spreading conscious life throughout the Universe seems worthwhile for what we are now, the descendants of Humanity at some future level of intelligence might determine deeper truths such as why the Universe exists and what that means with regard to our purpose within it.