On Friday 11 August 2006 20.35, Marc Weustink wrote: > >> What's the alternative? > > > > To have most of internal procedures public with a comment "for internal > > use only", I really don't like it, or to have all code in a single file, > > I don't like it too. > > What about "friend units'? > > Or something like as it is "solved" in delphi with helper classes (p215). > (Maybe we can also implement the strict version (p168)) > > http://info.borland.com/techpubs/delphi/Delphi2006/Reference.pdf >
It seems that FPC 2.1.1 implements the behaviour of Delphi 2006 'strict protected' by default. In MSEgui I have the problem that there is too much low level stuff to fit in one unit and the dependences are too complex to be mapped into a simple class hierarchy. Up to time I did as follows to access low level elements of classes in other units: " implementation type TLowLevelClassInOtherUnit1 = class(TLowLevelClassInOtherUnit); procedure TLowLevelClassInThisUnit.DoSomething; begin TLowLevelClassInOtherUnit1 (InstanceOfTLowLevelClassInOtherUnit).DoSomethingProtected; end; " It is ugly, produces warnings and is possibly forbidden in FPC 2.1.1 (I don't know). A more elegant solution would be to have something like 'friend units' where protected class members are visible: " unit secondlowlevelunit; interface uses firstlowlevelunit,highlevelunit; friends //use appropriate keyword and notation firstlowlevelunit; " -> In "secondlowlevelunit" all protected class members of "firstlowlevelunit" are visible, protected class members of "highlevelunit" are visible in descendant classes. Martin _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal