Discussion Thread: DIP 1033--Implicit Conversion of Expressions to Delegates--Community Review Round 1

Petar Petar
Wed Apr 22 19:08:08 UTC 2020


On Wednesday, 22 April 2020 at 17:48:35 UTC, kinke wrote:
> On Wednesday, 22 April 2020 at 16:53:09 UTC, Petar Kirov 
> [ZombineDev] wrote:
>> If this DIP is accepted, `lazy` could be deprecated, as it 
>> could be fully replaced by scope delegates, which are nothrow 
>> @nogc -betterC compatible.
>
> We don't need the DIP for that.

We need it in order to avoid API breaking changes. If we 
deprecate `lazy`, without this DIP this code will break:

   const result = cache.require(key, calculateValue(key));

> It would just allow not having to touch the call sites (just 
> the lazy *params*), but as said, I think the arguments should 
> be forced to be converted to regular delegates too, for 
> legibility and less confusion.

Reasonable people may disagree. Just like C programmers like the 
explicitness of passing a pointer to a local variable, while `T&` 
is being touted as one of the big improvements of C++, compared 
to C.


More information about the Digitalmars-d mailing list