@safe question

Paul Backus snarwin at gmail.com
Wed Jan 12 02:18:10 UTC 2022


On Wednesday, 12 January 2022 at 00:45:23 UTC, H. S. Teoh wrote:
> IMNSHO, that @trusted lambda thing is an anti-pattern that 
> should be avoided, needless to say already promoted.  It's 
> papering over a problem that ought to be fixed instead of being 
> pushed under the rug.

There's nothing wrong with @trusted lambdas. The recent FUD 
around them is almost entirely unjustified.

> If it takes -dip1000 to compile the OP's code, then I say, by 
> all means, use -dip1000.  It's not *that* hard to add a compile 
> switch to your build.  I know dip1000 isn't quite there yet, 
> but how is it supposed to "get there" if everyone is avoiding 
> to use it?

The reason I hesitate to recommend -preview=dip1000 to a 
beginning D programmer is that because the documentation is 
incomplete, it can be very difficult to *debug* DIP 1000 errors, 
and because the implementation has several known bugs, you cannot 
simply rely on the compiler to tell you when you've gotten things 
right.


More information about the Digitalmars-d-learn mailing list