idea: static scope(failure)

Steven Schveighoffer schveiguy at
Wed Jan 26 02:28:21 UTC 2022

On 1/25/22 9:07 PM, rikki cattermole wrote:
> Perhaps this can be simplified somewhat.
> version(compiles) {
>      ...
> } else {
>      string str = __errorMessage;
>      writeln(str);
> }

While this might be feasible, it suffers from the same problem as 
manually writing out the try/catch/finally blocks that scope(...) lowers 
to -- You need to enblock all the covered code, add indentation, modify 
lines that are far away (e.g. to add a brace) etc.

That being said, I'd be happy with anything that helps here.


More information about the Digitalmars-d mailing list