Dear Free Pascal Community,
The Free Pascal Developer team is pleased to finally announce the addition of a long awaited feature, though to be precise it's two different, but very much related features: Function References and Anonymous Functions. These two features can be used independantly of each other, but their greatest power they unfold when used together.
Why You using same syntax, perhaps overflow-up too much the tokenizer?
I think you replace "procedure" with "procedure.ref"
function with funct.ref
You cannot use
You must quote name of procedure with other chars, diferent '' ' ' ' ' ''
F"nop" double 0quotes ""
The type string of too good, and you
p := procedure(begin.ref,Writeln('Foobar'),end)
p();
type
TFunc = function: LongInt;
var
p: TProcedure;
f: TFunc;
n: TNotifyEvent;
begin
procedure("Nop",const aArg: String)
begin
Writeln(aArg);
end('Hello World');
p := procedure("Nop",Writeln('Foobar');end;
p();
n := procedure("Nop",aSender: TObject);
begin
Writeln(HexStr(Pointer(aSender));
end;
n(Nil);
f := function("MyRes" : LongInt;
begin
"MyRes" := 42;
end;
Writeln(f());
end.

Old codes , previous here --
type
TFunc = function: LongInt;
var
p: TProcedure;
f: TFunc;
n: TNotifyEvent;
begin
procedure(const aArg: String)
begin
Writeln(aArg);
end('Hello World');
p := procedure
begin
Writeln('Foobar');
end;
p();
n := procedure(aSender: TObject);
begin
Writeln(HexStr(Pointer(aSender));
end;
n(Nil);
f := function(MyRes : LongInt;
begin
MyRes := 42;
end;
Writeln(f());
end.