Discussion Thread: DIP 1038-- at nodiscard--Community Review Round 1

Jacob Carlborg doob at me.com
Fri Dec 11 19:54:58 UTC 2020


On 2020-12-11 09:03, Guillaume Piolat wrote:

> So, er.... I feel in the "target market" of this DIP, we use 
> D-with-runtime-disabled
> and the codebase is completely @nogc.
> The DIP is not that appealing to me because we do manage to throw/catch 
> anyway with manually allocated exceptions.
> 
> So most likely I would put this attribute in the "do not use" list of D 
> features.
> 
> I'd be more excited about:
> - throw-by-value exceptions
> - a way to use exceptions in @nogc and even -betterC (There was a DIP 
> for it, it was implemented, but doesn't work IIRC)
> than improving error codes.

I completely agree. Instead of this approach, the compiler could lower 
try/catch/finally/throw for a function to return tagged union of the 
success value and all the exceptions that can be thrown. Then one could 
easily throw any kind of types, not just classes inheriting from 
`Throwable`, including value types.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list