It is interesting to see the critical but appreciative manner in which Karl Barth engages with the optimism of the 18th century, particularly embodied in Leibniz [better known to a science nerd like me as co-inventor of Calculus than as a philosopher].
Note that the wikipedia entry on Leibniz's Theodicy and optimism, states "the word “optimism” here is used in the sense of optimal, not in the mood related sense, as being positively hopeful, as contrary to pessimism."
As usual Barth is full of surprises.
It is worth considering this historical phenomenon, because in all its forms it approximates closely to the doctrine of creation as justification as it must be represented in dogmatics, and this approximation cannot be overlooked, and is not so simple to explain as might at first sight appear.Karl Barth, Church Dogmatics 3.1 The Doctrine of Creation, p.404-7.
We, too, have had to state clearly the principle that the nature as well as the existence of the created world is affirmed by God its Creator, so that to this extent it is justified and perfect.
It is notable that in the whole history of ideas there is hardly a single verdict which verbally corresponds so closely to the Christian verdict as that of 18th century optimism....
It cannot be denied that Leibniz and all his stronger and weaker followers proclaim glad tidings, and thus display a formal affinity to the proclamation of the Gospel. Nor is it an accident that this century of all others produced the finest music: J. S. Bach and G. F. Handel, Gluck and Haydn, and the incomparable Mozart. And from this source there gushed out in other directions too a whole stream of natural joy in life in the strength of which we still live to-day....
Maintaining the same background, but emerging from it, even Christian preaching must take up again the theme of the stern and unmistakeable judgments of God, and learn to proclaim rather more radically and restrainedly what it means that all things work together for good to them that love God....
[Leibniz] must be taken seriously in dogmatics because he too, although in a very different way, tried to sing, and in his own way did in fact sing, the unqualified praise of God the Creator in His relationship to the creature....
....the Christian way of affirming the Creator's justifying Yes to His creation obviously has another dimension and a wider scope. It includes what is palpably missing in optimism: a true and urgent and inescapable awareness of the imperilling of creation by its limits, of sin and death and the devil. Unlike optimism, it has a compelling reason to view reality as a whole and therefore in this dimension too, and to take it seriously as a whole and therefore with an eye to this aspect too. For this reason it cannot be equated with 18th century optimism.