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

kinke noone at nowhere.com
Wed Apr 22 14:04:36 UTC 2020


On Wednesday, 22 April 2020 at 12:30:52 UTC, Steven Schveighoffer 
wrote:
> This is more of a problem of lazy parameters that mutate 
> something. Most of the time, that isn't the use case of lazy -- 
> it's to prevent calling some expensive thing when it's not 
> needed.

I disagree - `foo(myData.recomputeFromScratch())` has the same 
problem, it's not obvious from the call site alone that the 
expensive operation is deferred and might be skipped.

> To that end, would it be possible to add lazy binding to a 
> delegate in the same DIP? The more we make lazy behave like a 
> delegate, the easier it will be to remove lazy.

That might be a migration path towards removing lazy, so that the 
call sites can switch to delegates already, and the lazy params 
transformed to explicit delegates in a 2nd step. No idea if such 
a two-step approach would be worth it though.


More information about the Digitalmars-d mailing list