At 13:09 +0200 5/7/05, Marco van de Voort wrote:
In gmane.comp.compilers.gpc, you wrote:
What facilities does GPC have for forward defining types.
In CW Pascal, I have some code that looks like this:
[...]
MyObjectB = object; f: MyObjectA; // other references to ObjectA end;
(btw Does this compile? Note the semi-colon after object)
No, sorry, it was only meant as a basic idea, I didn't actually run it through the compiler to get out any silly syntax errors like that.
Delphi supports this: (remember its object model is similar)
Type MyObjectB = class; MyObjectA = class; MyProc = procedure( browser: MyObjectA ); MyObjectA = class f: MyProc; b: MyObjectB; procedure Doit( proc: MyProc ); function GetB: MyObjectB; end; MyObjectB = class f: MyObjectA; // other references to ObjectA end;
Must be in one typeblock though, IOW, the same system as pointers. For MacPascal mode object=class btw.
Yes, that would be what I'd expect, although the EP definition of class .. end; is acceptable to.
I'd suggest GPC accept either syntax to be compatible with Delph and EP (as well as allowing it with "object" when using reference objects for the Mac case).
Enjoy, Peter.
Peter N Lewis wrote:
MyObjectB = class; MyObjectA = class;
Yes, that would be what I'd expect, although the EP definition of class .. end; is acceptable to.
I'd suggest GPC accept either syntax to be compatible with Delph and EP (as well as allowing it with "object" when using reference objects for the Mac case).
I think so (of course, as usual, with respective dialect mode checks).
Frank