C++ Logo

std-proposals

Advanced search

Re: [std-proposals] try else syntax for validity check

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 18 Feb 2025 18:07:08 -0300
On Tuesday, 18 February 2025 17:56:01 Brasilia Standard Time Filip wrote:
> @Thiago
> You’re right about my types using -> with possible throw, I have this
> problem with foreign API that needs to be checked.
>
> Over time I’ve grown to dislike operator overloading, operator ? might be a
> good solution here, safe dereference, essentially monadic and_then.
>
> I would like some hard and unchangeable solution only for safety.

A monadic and_then with a terse, core language syntax may be accepted. Lambdas
are, after all, just a special syntax for declaring a functor. You just need
to show that this would be useful in a large number of use-cases, simplify
both reading and writing code, etc.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2025-02-18 21:07:16