DrDiettrich  wrote / nap�sal (a):

Ales Katona wrote:



C++ requires "friend" only because it lacks the idea of modularity.
Since all classes are "apart" they need some way to tell each other "I
can use you"
In pascal you simply put them into 1 unit.



That's why the C++ model is better, there exists no requirement to implement related classes in a single module.

In porting C++ code to Pascal I often stumbled into circular unit
references. Then the only solution is a monster unit, that implements
all the related classes at once, where the C++ implementation can be
split into appropriate modules. Even in Java it's possible to implement
every class in a dedicated unit, regardless of class relationships, and
without a need for separate header files. That's what I call a good
modular concept.


Perhaps I dislike Pascal include files only because they are poorly supported by the Delphi IDE. With better support it were possible to split the implementation into multiple dedicated include files, which could be thought of as implementation files, according to e.g. the Modula model. Lazarus offers better support for included files, but unfortunately it currently groups the types, constants etc. overview together by the according clauses; I hope for better grouping options in the near future, so that e.g. all types of an unit can reside in a single group. I already considered to contribute to the Lazarus development, but currently I have other projects with higher priority...

DoDi


_______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel



This is actualy a C problem. If you imagine the outcome any bigger C program is one big piece of code. If C/C++ had proper modularity support, things like this wouldn't happen.

Ales

_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to