Curious more than anything, if is nested captures state in a record and passes 
it as an hidden self param, why does returning the variable and calling from 
outside the calling stack frame corrupt the data? It seems like it technically 
should be there.

==================

type
  TProc = procedure is nested;

function TestNested: TProc;
var
  data: integer;
begin
  data := 100;

  result := procedure
  begin
    writeln(data);
  end;
end;

var
  proc: TProc;
begin
  proc := TestNested;
  proc();
end.

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to