Peter N Lewis wrote:
At 9:44 +0100 22/7/03, Prof. A Olowofoyeku (The African Chief) wrote:
As for the implicit object pointer dereferencing, I'm still
waiting to
decide whether it's useful to do it with pointers to (existing) objects, or if not a distinct object reference type will be necessary anyway (so it wouldn't make much sense to klduge it now with object pointers).
Please don't do it with plain old BP objects (except perhaps when the Mac defines are turned on). As you said, a reference type will be necessary anyway. Anyone who wants the implicit dereferencing can use the new object type when it is implemented. IMHO the BP object model should be kept intact, since it is now a lowest common denominator for many Pascal compilers.
As mentioned, all that is minimally required is allowing (with an option turned on)
objectptr.field as a synonym for objectptr^.field
Since otherwise the former code will simply give an error, there should be no compatibility problems for existing code or code written to the existing BP standard.
And extra nicety would be to allow:
type newobject = object(objectptr) ... end;
which again would otherwise simply be an error.
With these two, it would be relatively trivial to write compatible code, the only changes needed would be:
type myobject = object(superobject) ... end;
converts to type myobject = ^myrealobject; myrealobject = object(superobject) ... end;
(that would be the final nicety, but would be incompatible semantics for compatible syntax).
I think after that everything would "just work", since:
var o: myobject; new(o);
would be unchanged, as would dispose(o) and o.method or o.variable
This seems relatively simple, very safe, and within the GPC's goal of being a super set of all Pascals without introducing incompatible semantics for compatible syntax.
As long as Peter's proposal is an option that can be turned on and off, I think everybody can be perfectly happy with it. I suggest that the option is turned off by default, except for --mac-pascal (and maybe for --delphi).
Regards,
Adriaan van Os