Forwarded from marcov@stack.nl (Marco van de Voort):
In gmane.comp.compilers.gpc, you wrote:
Frank Heckenbach wrote:
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?
Yes, though object-instance might be a better phrasing.
Yes, I mean an instance.
It works though with uninitialised objects too as long as you don't actually "use" (dereference) self:
I see. But I suppose Markus also wants to call the method via the procedural variable later and apply it to a certain object instance (selected at call time), something like (depending on the syntax chosen):
someotherx.y (5);
or:
y (someotherx, 5);
I'm a bit worried that this syntax is a bit focused on object types that are already (implicitely) a pointer, like Delphi.
For the syntax, adding a @ or ^ here and there should be all that's required.
If this is possible with (one of ) your object models, better warn if you try to assign a methodvar to a method of an object that is on the stack instead of on the heap.
Of course, that can be a problem -- as always if not carefully used. BTW, do you warn if taking the address (@) of a normal (non-object) variable on the stack?
Frank