Mac objects and Delphi classes
Peter N Lewis
peter at stairways.com.au
Fri Aug 5 10:11:22 CEST 2005
At 3:37 +0200 5/8/05, Waldek Hebisch wrote:
>Frank Heckenbach wrote:
> > Peter N Lewis wrote:
> > > Looks good. Can we add control over the warning:
>> > warning: object type has virtual method, but no constructor
>> > off by default in Mac Pascal, possibly off for objects-are-references?
>> > What is the reasoning for the warning, why are objects supposed to
>> > have a constructor?
>> BP requires it. In fact, a constructor doesn't only have to exist,
>> but must be called at runtime before virtual method calls will work.
>> GPC doesn't require this, even in the BP model, so the warning is
>> more for compatibility.
Ok, an option to disable it would be good then.
>In Delphi each class is a descendant of TObject. TObject has a predefined
>constructor called Create. As I wrote ATM the most visible difference
>between OOE/Delphi and our current implementation of classes is that
>we do not implement Root/TObject.
>I belive that we can use a single type as both Root and TObject.
>Namely, TObject has more methods, but if we allow silent shadowing
>then the extra methods will be invisible to OOE programs.
Ok. Mac objects don't have any concept of Root or TObject base
object (various class library frameworks have implemented their own
base object, but that is a code level issue). I guess as long as
there is no significant overhead it would not matter if there was
some invisible Root/TObject/base object, although personally I'd
prefer to avoid it, so hopefully you'll make it optional, although
the OOE Root object looks fairly harmless (unless I'll get errors
when I write my own Create/Destroy methods with different parameters
or without the "override" keyword).
More information about the Gpc