
On 01.02.2018 14:32, Andrey Semashev via Boost wrote:
On 02/01/18 15:03, Jonathan Müller via Boost wrote:
And accessing the value on an optional without checking it should always be a red flag and not just written "naturally" (That's why operator-> for optional is a mistake IMO).
I disagree. The necessity to write ".value()" on every access to `a` is an overhead, both in user's effort and runtime performance. This, actually, illustrates my point.
With my proposal, `value()` would be the unchecked (i.e. debug checked) access, so it has no effort on runtime performance. Yes, it is less convenient than exceptions, that's why you should still prefer exceptions without more language support for optionals and expected objects. But I don't think it is more error prone than exceptions, which is the point I'm trying to make.