Boost logo

Boost :

Subject: Re: [boost] [review] Review of Outcome v2 (Fri-19-Jan to Sun-28-Jan, 2018)
From: Jonathan Müller (jonathanmueller.dev_at_[hidden])
Date: 2018-02-01 13:40:02


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk