Open question: what code pattern you use usually for null safety problem

Basile B. b2.temp at gmx.com
Fri Jan 15 22:42:40 UTC 2021


On Thursday, 14 January 2021 at 18:24:44 UTC, ddcovery wrote:
> I know there is other threads about null safety and the 
> "possible" ways to support this in D and so on.
> [...]
> If it's not a bother, I'd like to know how you usually approach 
> it
>
> [...]
>
> Thanks!!!

I have a opDispatch solution here [1], probably very similar to 
the other opDispatch solution mentioned. It is used in d-scanner 
since several years, e.g here [2]. I'd like to have this as a 
first class operator because as usual in D,  you can do great 
things with templates but then completion is totally unable to 
deal with them. Also There's a great difference between using the 
template to do refacts and using it to write new code. Very 
frustrating to write `safeAcess(stuff). ` and no completion popup 
appears.

[1]: 
https://gitlab.com/basile.b/iz/-/blob/master/import/iz/sugar.d#L1655
[2]: 
https://github.com/dlang-community/D-Scanner/blob/2963358eb4a24064b0893493684d4075361297eb/src/dscanner/analysis/assert_without_msg.d#L42




More information about the Digitalmars-d-learn mailing list