KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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? function ReturnTwoStrings (out Str1 : String) : String; begin ExecuteProcedure (procedure begin Str1 := 'First String'; Result := 'Second String'; end); end; Very artificial example of course, but I ran into some situations where this would have been useful. 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. EDIT I just realized that it works for normal parameters like ... (List : TList) 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?
Tags (comma-separated)
Save Edits
Cancel