Worst ideas/features in programming languages?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Tue Nov 9 11:09:07 UTC 2021


On Tuesday, 9 November 2021 at 10:58:34 UTC, bauss wrote:
> On Monday, 8 November 2021 at 14:23:15 UTC, Ola Fosheim Grøstad 
> wrote:
>> On Monday, 8 November 2021 at 14:08:32 UTC, Atila Neves wrote:
>>> I thought Rust error handling wasn't easy by default until 
>>> they added the ? operator, at which point it became like 
>>> exceptions but better.
>>
>> Looks like syntactical sugar to me, but I am no Rust expert. 
>> It means you now loose context, and how do you log?
>>
>
> It propagates the error to the caller, so you don't lose 
> context, as the error still needs to be handled somewhere, you 
> just don't explicitly have to return the error from your 
> function etc. If you need to log the error at the specific 
> location etc. then you just don't use the ? operator.

As a library author you don't know what the application is 
interested in.

Anyway, they are working on retaining context, so the Rust 
developers apparently see this as being an issue.

If you can only use "?" in one location without loosing context 
that basically establishes it as being the quick hack it looks 
like (by reading the docs).



More information about the Digitalmars-d mailing list