Boost logo

Boost :

Subject: Re: [boost] [review] Review of Outcome v2 (Fri-19-Jan to Sun-28-Jan, 2018)
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2018-02-01 14:53:08

On 02/01/18 16:40, Jonathan Müller via Boost wrote:
> 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.

If your `value()` is unchecked then I really don't understand how
writing `a.value().foo()` would be less error prone than the current
`a->foo()` without a prior check.

> 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.

The more code you have to type, the more places where you can make a
mistake. My point is that since with exceptions you don't need to type
any code to test for errors, except where you actually do, it is less
error prone.

Boost list run by bdawes at, gregod at, cpdaniel at, john at