Dynamic object methods

Prof A Olowofoyeku (The African Chief) chiefsoft at bigfoot.com
Wed Apr 23 00:39:45 CEST 2003


On 22 Apr 2003 at 17:54, Frank Heckenbach wrote:

> One item on the to-do list are BP compatible dynamic methods. As far as
> I understand the BP description, they are semantically equivalent to
> virtual methods, only the syntax is different (an integer index added)
> and the implementation (which we don't have to follow, of course).
> 
> Ignoring this index syntactically would be easy to do. Would this be
> useful, and is it really all that's required?

Ignoring the index would make a dynamic method the same as a virtual 
method. This can be somewhat useful (with appropriate health warnings) 
when porting existing code (i.e., GPC accepts the syntax, but the 
meaning would be different). From what I can see the real usefulness of 
dynamic methods (apart from alleged savings in memory) lies in the 
index. BP uses this for its message dispatching mechanisms in the OWL 
framework (although this is probably at library level rather than at 
compiler level). Delphi can use it as well. I have sorely missed this 
feature when trying to build an OWL-compatible OOP framework, and have 
had to find klugdes round it. A simple example;
type foo = object (tfoo)
 procedure cmSave (var m : tmessage); virtual cm_Save;
end;

What this means in BP/Delphi is that when the menu or button (or 
whatever) with the integer ID of cm_Save is selected/clicked, etc., 
then run the method "cmSave". Obviously there is a message dispatch 
mechanism involved, in order for anything to know that cm_Save has been 
clicked/selected.

Having now written all this, I am starting to wonder as to its 
relevance as it seems clear that this has nothing to do with the 
compiler per se ;-/

Best regards, The Chief
--------
Prof. Abimbola A. Olowofoyeku (The African Chief) 
web:  http://www.bigfoot.com/~african_chief/




More information about the Gpc mailing list