Example of Rust code

Jakob Ovrum jakobovrum at gmail.com
Sat Aug 11 07:37:01 PDT 2012


On Saturday, 11 August 2012 at 11:24:35 UTC, Marco Leise wrote:
> Can you quickly explain the use of scope here? Does that mean 
> "I wont keep a reference to e"?
> What are the implications? Does scope change the method 
> signature? Does the compiler enforce something? Will generated 
> code differ? Does it prevent bugs or is it documentation for 
> the user of the function?
> Thanks in advance for some insight!

The generated code is different when the parameter is a delegate 
(no closure is allocated in cases of anonymous functions/lamdas 
or expressions like &myNestedFunction). It's supposed to be 
enforced by the compiler that no references escape, but currently 
it's just documentation beyond the case of delegates.


More information about the Digitalmars-d mailing list