Martin Schreiber schrieb:

May I repeat the idea of "friend units"?
While designing a complex framework like Lazarus, fpGUI or MSEgui there constantly is the need to access low level functions from other classes. Now one has the options to write the whole framework in a single unit (ex. db.pas), to make most of the class elements public or to use local alias type definitions.

This also requires to modify the existing classes. If every user can do that, encapsulation *really* has gone away :-(


The introduction of "friend units" would be a simple solution. In "friend units" the protected class members would be visible. So if you build a framework and you know what you do, list the base units of the framework as friends of higher level units of the same framework.

See "framework" as an special case of what a user wants to achieve. Where will you draw a boundary between *acceptable* and *unwanted* breaking of visibility, by using friends, class helpers or any other means?

DoDi


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to