[fpc-devel]Some idea of joint units
Exebook.com
ebooks at exebook.com
Thu Nov 13 17:06:00 CET 2003
> So (again IMHO) the disadvantages outstrip the disadvantages by far.
Ouch, not exactly so my dear. What you mean is the redundant code has the
chance to get into the executable. But first there is smartlinking, second
there could be "smartuniting" and third, most libraries anyway use all the
units, declared from each other. For instance I downloaded jpeg.pas and it
uses 100 other units from the package, but to utilize this library in my
program I had to add at least 5 units! jpeg.pas, jpegsave.pas, jpegload.pas,
jpegbase.pas and even some others. Those _all_ are anyway used in jpeg.pas,
so the code is anyway in the executable, but it is not convenient to add 5
units everywhere I need jpeg graphics. Other example is tollbar library I
downloaded a some time ago, the main unit links to 50 other units, and to
use the library properly you have to declare from 3 to 10 of them in your
uses clause, inconvenient. Examples are many! Just to lazy to count, and
almost always all the units are explicitly declared in the main unit, so the
code always gets into the executable anyway. Another simple example is the
RSA crypto lib, it uses bigint.pas. If you want to crypt something - you
will always need bigint.pas just to declare the key/signature variables,
this would be really convenient if the rsa.pas had the "reuse bigint" line
somewhere in the interface part - and no extra byte will go to the exe
anyways. Hope this makes sense. If no, just believe me, I program since
80-ies and this partucular feature of pascal was coming into my head every
now and again, so it is kinde "tested by time". I would not recommend to
discuss it if the results would be rather negative and the idea was not well
thought. I do not want to spare your busy time of course, not a minute
without a good reason for the entire community.
Also back to first and second of my points - "smartuniting" (smartlinking in
terms of units rather than procedures) is relativly simple feature, that can
propagate into the compiler along with the "reuse" keyword. So that only
those units from the "Reuse" list are actually demanded from the main
program or unit would link. And smartlinking (in terms of procedures) is
already there, it is not enabled by default for some reason though. By the
way I would like to know why it is not the default behaivior, I suspect it
is due to it's buggy nature, but maybe one day it can be declared "stable".
More information about the fpc-devel
mailing list