May 22, 2012 Re: Lazy evaluation of function arguments in D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | On Monday, 21 May 2012 at 09:35:30 UTC, Timon Gehr wrote: >[cut] > int x; > > void f(int){x=anything;} > > void main(){ f(x++); } Yes, and that's why you're supposed to *avoid* the use of global variables as much as possible.. Thanks for showing that "lazy" has the same issue as global variables.. [cut] > f(()=>x++) is already short enough. I would prefer f({x++}) instead but that may be bikeshedding.. renoX | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply