|
Home
>
3. concept
>
3.2 libraries and modules
>
3.2.2 Why aren't the "define module" declarations nested within the "define library" ones?
|
Previous
Next
|
|
|
|
|
|
Kim Barrett
|
The library is by definition the unit of compilation for
Dylan.
|
|
Bruce Hoult
|
I don't understand the rules for the "define library" and "define module"
declarations themselves. Why aren't the "define module" declarations
nested within the "define library" ones?
Does the scope of the "define library" extend to the end of the file? Is
it possible to have more than one "define library" declaration in the
same file?
|
|
Kim Barrett
|
They are separate so that you can easily have two libraries which
include the same module.
Say there are two libraries for two different products, and both use the
same utility module. That utility module could be packaged in a
separate third library which is used by both of the first two. But that
might increase opportunities for configuration problems, and might
decrease optimization opportunities due to separate compilation of the
product library and the utility library. Kind of like the choice between
dynamically linking or statically linking a library. That utility module
could have its module definition copied into the two product libraries,
but that would likely lead to the usual multiple copies of the same
source code problems, so was not seriously considered as a solution
to this problem.
|
|
|
|
|
|