function TFlatBlock.SelectRow(const C:TConditionR):TArray<TFlatRow>;
begin
Result := nil;
if not Assigned(C) then Exit;
//
SearchRow(function(const R:TFlatRow):Boolean
begin
// Result from TFlatBlock.SelectRow !!!
if C(R) then Result := Result + [R];
// Result from lambda
Result := false;
end);
end;
How to qualify var Result in this case? Yes I can use local variable instead, but maybe there is a way to do this without it.
SelectRow
instead ofResult
(in Pascal, the function name can be used instead of theResult
variable), but the compiler didn't allow that (instead it considered it a function call). I also triedvar OuterResult: T absolute Result
which made the compiler tell me "cannot capture symbol Result". That tells me it isn't doable. The same error message happens if you use an anonymous procedure instead of a function (in which case there is no ambiguity). – Andreas Rejbrand Nov 26 '20 at 19:33