[OT] Is there a real alternative to exceptions ?
monkyyy
crazymonkyyy at gmail.com
Thu Jan 16 19:13:38 UTC 2025
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)`.
>
> that problem is currently something rather serious, in the
> sense that, let's say you want to make a standard library, you
> really need to have a well defined way of handling errors.
>
> I'll be interested to read your thoughts on that topic.
1) add a error code system to the range api
2) damn the consequences have fail safe functions(1/0==int.max)
3) store errors and extra control flow in my `innate` pattern
4) nullable everywhere, range functions can react to nullable
elements
5) preallocate some space for exceptions, cap the size of
exception objects(assuming this is about betterc)
More information about the Digitalmars-d
mailing list