On Sun, 1 Jun 1997, Peter Gerwinski wrote:
It's even more trivial: At the moment, I artificially forbid constructors to be virtual. To enable them, I would just have to take out the error message.
To those that were thinking about removing the Init constructor... We'd now need an anscestor...
Okay for ordinal types, sets and pointers, not sure about Reals. Strings initialized to zero this way are BROKEN because they get a capacity of zero which makes them useless. :-( That's one reason why I would like to have `ShortString's in GPC.)
Ok, right, so FillChar() is a BAD idea... Ok! :-)
Internally, objects are ordinary records anyway, so this makes no difference in hacking GPC - except that if I introduce an `interface' type I have to remember that something *is* an interface for no other purpose than outputting error messages. In this sense, I would prefer not to introduce interfaces as another data type but to allow MI for some special cases which I would have to check anyway. (See below for a relativation of this.)
But interfaces are there just for that! They are like type information, they are used only by the compiler at compile time to generate error messages... Say you have a class X with methods A, B and C. If you compile the thing, then change the source to add an interface Y that has B and C and make the class implement the Y interface, and recompile, it should generate roughly the same code. The only thing is that now class X is now compatible with all other classes implementing the Y interface.
As I said above, I'd vote for the second idea ("interface" is a keyword anyway). AFAICS, the Delphi syntax as shown in the example by David looks like we could adopt most of it -- as I said, I'm not sure about the IUnknown bit, but I think it can be optional (just declared as an empty interface for compatibility reasons).
Oh, BTW, the IUnknown thing is like TObject, it is a "parent interface"...
This removes all needs for class registration, and perhaps solves some problems with interfaces. I think I like that!
I agree, *and* having that we could claim more compatibility to Delphi thus making GPC more attractive for a lot of possible users.
This "registration number" is a very Windowy thing. BTW, do you have a way to avoid collision of those numbers for precompiled units that don't have sources available? With something like TV registration, if an registration error comes up during registration, I just register the class by hand with a different number, and my problems are gone!
Pierre Phaneuf
"The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense." - Edsger W. Dijkstra.