title: Scope of anonymous methods
body: <p>One nice thing about anonymous methods is that I can use variables that are local in the calling context. Is there any reason why this does not work for out-parameters and function results?</p>
  
  <pre><code>function ReturnTwoStrings (out Str1 : String) : String;
  begin
    ExecuteProcedure (procedure
                      begin
                        Str1 := 'First String';
                        Result := 'Second String';
                      end);
  end;
  </code></pre>
  
  <p>Very artificial example of course, but I ran into some situations where this would have been useful.</p>
  
  <p>When I try to compile this, the compiler complains that he "cannot capture symbols". Also, I got an internal error once when I tried to do this.</p>
  
  <p><strong>EDIT</strong> I just realized that it works for normal parameters like</p>
  
  <pre><code>... (List : TList)
  </code></pre>
  
  <p>Isn't that as problematic as the other cases? Who guarantees that the reference is still pointing to an alive object whenever the anonymous method is executed? </p>