[OT] Is there a real alternative to exceptions ?

Paulo Pinto pjmlp at progtools.org
Fri Jan 17 21:47:10 UTC 2025


On Friday, 17 January 2025 at 00:21:35 UTC, Meta wrote:
> On Thursday, 16 January 2025 at 19:02:05 UTC, Basile B. wrote:
>> I have the feeling that things like
>>
>> ```
>> a.map!(mapperFun).reduce!(reducerFun).array;
>> ```
>>
>> is only possible thanks to an exception system. A similar 
>> expressivity looks impossible for example with the idom of 
>> result tuple `(error_code, actuallResult)`.
>
> It's very easily doable, arguably with even better ergonomics 
> than with exceptions:
> https://fsharpforfunandprofit.com/rop/
>
> C/C++ programmers are just stuck in the 80s 😛

Some may be, others go with the times, courtesy of C++23.

https://en.cppreference.com/w/cpp/utility/expected

https://en.cppreference.com/w/cpp/utility/optional

https://en.cppreference.com/w/cpp/ranges


More information about the Digitalmars-d mailing list