On Wed, 2010-01-06 at 16:56 +0300, Nikolai ZHUBR wrote:
Wednesday, January 06, 2010, 2:47:24 PM, Juha Manninen wrote:
On keskiviikko, 6. tammikuuta 2010 13:14:18 Michael Van Canneyt wrote:
Why ? Every class in 1 file is perfectly possible with include files, and 1
big unit file.
Ok, include files seem to solve this problem.
I don't know why they are not commonly used in Delphi programs as source
An include file by its pure nature is just an arbitary fragment. It
does not necessarily have any consistent meaning on its own, either
logically or syntactically. Therefore, compiler does not (and have
no way to) do any integrity/dependancy checking on include file as
on a separate entity. For the same reason, looking at an include file
may give absolutely no idea of its meaning unless you also open all
its including files along with.
The concept of include files is not part of the language. It is just
a tool to mitigate the troubles of editing/storage/archiving and
such other maintenance burden tasks. From the language perspective,
include files just do not exist! They are substituted textually, just
like copy-n-paste, effectively producing one (big or not, whatever)
file anyway. Period.
On the other hand, object pascal as a language offers 2 mechanisms
for structuring code logically: units and classes. Both are
language concepts, both allow compiler to actively help programmer
by means of visibility restrictions etc. I would say, some corner
cases do exist, where the concept of units and the concept of classes
somehow clinch in unconfortable manner. IMHO this does not happen
too often and there are some known workarounds. Still probably,
the language in its current form has its limits. Maybe these could
be extended eventually, at least out of academic curiosity. In
practice however, object pascal already provides such benefits that
it is imho quite fair to tolerate some corner rough edges.
To summarize: From the language/compiler point of view, large files are
no problem. We already concluded that, and in some cases the language
even forces you to use large files.
But, from a personal - human point of view, large files are not always
nice. At least, some people think so. They want to have some overview
over the file, or have some preference for one class in a file. (Why?
Well, people are not logic entities, they can not handle very complex
things) Yes, an IDE can help with that.
Or include files. So include files are only useful for the mindset of
people, the compiler doesn't care.
So it's completely up to you: do you really need (not possible: want)
small files? Use include files. (Are you using Delphi, bad luck;) )
Don't you need small files: there is no problem at all.
Joost.
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel