Hacking "method variables"
ih8mj at fjf.gnu.de
Fri Jun 9 20:36:53 CEST 2006
Frank Heckenbach wrote:
> 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;
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 Heckenbach, frank at g-n-u.de, http://fjf.gnu.de/, 7977168E
GPC To-Do list, latest features, fixed bugs:
GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE D101 CD02 4C9D 0FE0 E5E8
More information about the Gpc