Peter N Lewis wrote:
In Mac Pascal, each method name must be unique within any object (including inherited objects, recursively). A super-object may override an existing method in an (recursively) inherited object (ie, define a method with an already existing name) , if the new definition exactly matches the old definitions prototype, and the keyword "override" is specified. Otherwise, yes it is an error.
So that's another incompatibility to BP. You may say that they don't really conflict since either way (with and without `override') would be an error in one of the dialects. But it would mean that if by default we allow the union of both dialects, `override' would mean almost nothing.
BTW, A quick idea for the object pointers: If we allow `Parent' in `type Foo = object (Parent)' to be an object pointer type, it *may* (still doubtful) be useful to make `Foo' a pointer as well. This way the syntactic difference would be limited to the root object types. This would be particularly useful if there's (by convention or requirement) only one root object type (presumable in a standard unit then), so user programs wouldn't see any difference. But I'm not sure if that's useful or rather a kludge ...
This sounds a bit dubious to me.
One possibility would be to use attributes (but I think you don't currently have type attributes, right?). If we did, presumably something like:
type Foo = object ... end; attribute( pointer );
We have type attributes, but I don't see what this would gain. You'd have to modify the type declaration, just as if you had to declare the pointer explicitly. Besides, since the attribute appears at the end of the declaration, it's not known while parsing the fields and methods. This may not be a problem now (because GPC does most of the work at the end of an object type declaration, anyway), but it would add a restriction for future changes.
Currently I tend to distinguish the object kinds strictly, i.e. specify on the declaration whether it's a BP/GPC or Mac style object. This would then influence pointers, virtual methods, `override' and anything else that may be required.
The best way to do so might be a special option. This wouldn't require new syntax, and it would usually be global (which is usually wanted), though it can be changed locally.
The disadvantage is that the default dialect then is not a superset of everything. But it would only take the flipping of an option to get it all. (It would be a separate option, of course, perhaps `--mac-objects' or so, coupled to `--mac-pascal'.) I.e., it would be possible to mix different kinds of objects in a program (though I'm not sure if it should be possible to inherit between them -- due to `override' etc., I tend not to).
Frank