Forwarded from marcov@stack.nl (Marco van de Voort):
In gmane.comp.compilers.gpc, you wrote:
Yes, the first problem is to define a syntax. I think there might have been some suggestions before, but nothing concrete so far AFAIR. Do other dialects have something like that, if so which syntax?
Delphi syntax
type tbla = procedure bla(param1,param2,param3:integer) of object;
Only allowed to assign methods. (classes model)
Internally such beast is a record ("TMethod") with two fields. "code" and "data". Code contains a ptr to the function, data self or nil.
(the latter in case of "class" (static) methods)
Assignment is simple
var bla: tbla;
begin bla:=xx.methodname; end;
Frank Heckenbach wrote:
Forwarded from marcov@stack.nl (Marco van de Voort):
In gmane.comp.compilers.gpc, you wrote:
Yes, the first problem is to define a syntax. I think there might have been some suggestions before, but nothing concrete so far AFAIR. Do other dialects have something like that, if so which syntax?
Delphi syntax
type tbla = procedure bla(param1,param2,param3:integer) of object;
Only allowed to assign methods. (classes model)
Internally such beast is a record ("TMethod") with two fields. "code" and "data". Code contains a ptr to the function, data self or nil.
(the latter in case of "class" (static) methods)
Assignment is simple
var bla: tbla;
begin bla:=xx.methodname; end;
So IIUC, the difference to Markus' way is that here the procedural variable also contains the object, while there it only points to the method, and can be applied to any object (of matching type), right?
Frank