Waldek Hebisch wrote:
I would like to see real examples of Mac Objects.
Have you seen peter5.pas? (But that's all I know, so Peter might want to provide further examples.)
Anyway, we have at least four object models (BP, Delphi, OOE, Mac), and only two keywords (object, class, each used by two of them).
ATM I do not noticed serious incompatibility between Delphi and OOE: Delphi looks just like an extension of OOE subset (compatible with full OOE).
Probably. I expect the least problems between those two.
The question is if/how far we want to allow mixing of the models via inheritance. For the pointer/reference issue, we could probably say each type behaves according to the model it was declared, even if it inherits from other model's types. (Though we should check this can't lead to hidden problems.) For all-virtual-methods, we could either say Mac objects can only inherit from other objects if they (explicitly) have all methods virtual, or we don't require this so such a mixed object can have (inherited) non-virtual methods. I don't see a problem here at first glance, but again, should check more carefully.
I think that letting an object inherit from anything should work. In fact, one of my pet ideas is to let Pascal objects inherit from other language objects and vice-versa. AFAICS inheriting from Objective C objects is one of main CW Pascal extensions.
Surely, such code could break some patterns valid in single-model programming, but people who want to stay in a single model may do it, and the others probably will find added complexity worthwile.
Seems reasonable.
Generally I'm also wary of letting code generation depend on compiler options (though currently we do with `--methods-always-virtual'). So perhaps we should make the four models in default mode available with four different syntaxes (either two other names besides object and class, or keyword combinations, such as `virtual object' (= Mac) ??? etc., just fantasizing, or using attributes, or whatever). Then a default mode program could use them all without compiler directives. The dialect options would then only switch syntax, so e.g., in Mac mode, `object' means `virtual object', and other object models are forbidden.
I an not sure how Mac Pascal folks like `virtual object' but for me it looks fine.
In Mac Pascal mode, `object' would do the same; perhaps we should add a separate option `--object-model=mac' or something; and as a last resort, a {$define} will do.
Frank