A D vs. Rust example

Walter Bright newshound2 at digitalmars.com
Sat Oct 22 01:42:54 UTC 2022


On 10/21/2022 6:44 AM, Don Allen wrote:
> Which is contrary to the purpose of using closures -- to capture free variables 
> in the lexical environment, rather than having to pass them as arguments. What 
> you have done above could (and should) be re-written with ordinary functions.

The way dip1000 works with closures is to treat the uplevel variables as if they 
are passed by ref to the nested function. Which is of course how they are 
implemented.


More information about the Digitalmars-d mailing list