[gambit-list] Subdivide code into modules

Valeriya Pudova val1969 at neotech.lv
Thu Apr 30 02:50:43 EDT 2009


Hello good people,

| --- "A Tour of Scheme in Gambit.pdf"
| In Gambit, a good way to subdivide code is by using the X module system.
| The layout is pretty straight-forward:
| create a .scm-file . Start it with (module name) where name is the name.
| Then, declare what other modules to use with the (use) procedure.
For instance:
|   (use lib/srfi1 lib/http-client)

Is it true?

I see, the Gambit has two methods: 'include' and 'load'
First method 'include' lets subdivide app into files. It can be helpful
but it is pure method (similar to include of C language).
Programmer should avoid recursively included files, etc.
For me 'include' is not good way how to code app.

The method 'load' lets subdivide app into the modules. This should
be better that 'include' (for me). But it has limitation. The macro
definition usable only at one file.

|--- manual:
| To have access to the macro definitions contained in
| a file, that file must be included using the include special form.

Maybe that is why the statistic of using 'include' is higher that for
'load' method. Also i seen at the source files list of the
"Space Invaders classical arcade game" that programmer split
modules into 2 files one is for code and second for macros, and last
one must be included when first can be loaded.

Does not look like pretty. Fix me if I am wrong please.

What is correct template how to subdivide app into modules?
Maybe there is lightweight module system library exists?



More information about the Gambit-list mailing list