[fpc-pascal]Interface-only units (was: shared libraries interface)
memsom at post.interalpha.co.uk
Fri Aug 2 14:06:39 CEST 2002
Quoting Jonas Maebe <jonas at zeus.rug.ac.be>:
> On Fri, 2 Aug 2002, Full_Name wrote:
> > One other point.. surely the interface is there just for the
> > convenience of the developer - like a C header file.
> No, it's mainly to guarantee portability between different compiler
But the interface is still to be thought of as 'read only' ? Otherwise, it
would be possible to alter the interface... not good for maintenance.
eg. consider the following...
uses x, y, z;
TSomeEnumType = (set1, set2, set3, set4);
TMyClass = class
function SomeFunction(x: TSomeEnumType): string;
function SomeFunction2: TSomeEnumType;
procedure SomeProcedure(x: TSomeEnumType);
property X: TSomeEnumType read getX write setX;
What would happen if I compiler this, gave it to people, and someone changed
TSomeEnumType? For example to the following:
TSomeEnumType = (setNone, set1, set2, set3, set4, set5, set6);
If I had written code internally well, hopefully not too much would break, but
I still think this is dangerous. This is one reason why the DCU/TPU concept
arrived in the first place.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids,
we'd all be running around in darkened rooms, munching magic pills and
listening to repetitive electronic music."
Nintendo, Inc, 1989
-----BEGIN GEEK CODE BLOCK-----
GCS d? s+++:+ a- C++ UL+ P L++ E---- W- N+ o+ K- w
O- M V PS PE-- Y PGP- t- 5-- X- R- tv+ b+ DI++ D+
G e++ h--- r+++ y+++
------END GEEK CODE BLOCK------
More information about the fpc-pascal