@nogc and Exceptions

Adam D Ruppe destructionator at gmail.com
Thu Sep 29 23:53:03 UTC 2022


On Thursday, 29 September 2022 at 23:35:51 UTC, Guillaume Piolat 
wrote:
> Why not allow to throw an immutable(char)[] value instead of 
> Exception?

At that point, you might as well just throw an immutable static 
Error instance.

> Breaking the type system (@nogc) breaks D programs without 
> runtime, or an impaired runtime.

nogc and no druntime are entirely separate concepts. There's a 
little bit of overlap, but it is really easy to throw an 
exception allocated differently right now or otherwise depend on 
druntime while still satisfying nogc that it is maybe a useful 
filter reminder, but not at all comprehensive.

The most reliable way to see if something is no druntime 
compatible is to build it with no druntime and look for linker 
errors.


More information about the Digitalmars-d mailing list