On 15 Jul 2003 at 10:07, Peter N Lewis wrote:
Hi all,
I'm trying to reduce the gap between traditional Mac Pascal object models and GPC's current object model.
Frank's already added an option in to turn virtual on for all methods automatically, so that's reduced one major incompatibility. The other one is that in Mac Pascals, object is implicitly a pointer and implicitly dereferenced. That is:
type myobject = object v: Integer; procedure method; end; var obj: myobject; begin New( obj ); obj.v := 5; obj.method; end.
[...]
What you are describing is almost equal to the "new" style Delphi Classes (actually, this is already over 7 years old, so it is not so new - but I use "new" here to distinguish it from the original BP object model). That type of Delphi compatibility, is, I believe, on the to-do list - but perhaps not a high priority.
The main difference between what you propose and Delphi is that, under Delphi, you must call the object's constructor before you can do anything with it. The constructor call allocates memory for the object and returns a pointer to it (e.g., "obj := myobject.myconstructor"), and deferencing is automatic. But you must use "Class" when defining the object, and not "Object" (e.g., type myobject = class ....).
If your suggestion is accepted, then we might one day have 3 kinds of GPC objects - the old BP objects, the Delphi classes, and the Mac Pascal objects. I am not sure where this will lead us. Perhaps the Mac Pascal object type could be implemented as a superset or subset of the Delphi Class (or vice versa), since implementing one will have taken us almost to the point of being able to support the other.
I suspect that none of this is a great priority at the moment - but I might be wrong ....
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/