Hacking "method variables"

Frank Heckenbach ih8mj at fjf.gnu.de
Fri Jun 9 20:33:41 CEST 2006


Forwarded from marcov at 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;





More information about the Gpc mailing list