[Dynamite] (no subject)

Ian Holmes ihh@fruitfly.org
Sun, 9 Apr 2000 13:55:11 -0700 (PDT)


On Mon, 10 Apr 2000, Ewan Birney wrote:

> 
> Is there any point in suffixing each method as an _vf? Doesn't it
> apply to all methods? Am I missing something?
> 

the distinction is meaningless in IDL, but meaningful in the autogenerated
C.

methods without a "_vf" are inherited *without changes* in the C. (in fact
currently they aren't inherited at all - i.e. to call a base method on a
derived object, you have to actually convert the derived object back into
the base object.)
so, in other words, there is no way to override a non-_vf method.

methods with a "_vf" always go through function pointers in the C. hence
easy to override.

it is very close to C++'s method inheritance model.
the best way to see what's going on is to write a tiny example IDL file
using both kinds of method, and run it through idlstubs.

The "_vf" gets stripped off during the IDL-to-C mapping and it probably
isn't the best way to indicate a virtual function. Better would be to
define a macro like "EuclidVirtual" within the IDL. i.e.

	void my_method_vf();

becomes

	#define EuclidVirtual  /* empty macro */
	...
	EuclidVirtual void my_method();

again, this is fairly trivial to change.

ian