chi scripsit: > (use a) versus (declare (uses a)) what's the differences between those?
(use a), which can also be written (require-extension a), is the regular way of bringing in code and making identifiers available in the current environment. It first does a "require-library", which checks whether the library "a" has already been loaded, and if not, loads it (that is, "a.scm", "a.so", "a.dll", or "a.dylib"). Then it imports all the identifiers of a module named "a", which is presumed to have been loaded by the library "a", though this is not actually required. The (declare (uses a)) form is for use with the unit system, which precedes the module system as a method of code organization. It is pretty much only used internally to Chicken nowadays. > (use a) will load module...library...module... what do you call the > thing that (use) loads? Is it a library or a module? Both: see above. > But (import) imports modules that are already loaded from libraries. Correct. > Are libraries and modules equivalent? No. A library is normally a file, though there are some libraries that are built in to Chicken: see <http://wiki.call-cc.org/man/4/Non-standard%20macros%20and%20special%20forms#require-library> for details. A module is a Scheme form (module name ...). > Can a library have more than one module? Yes, although I advise against it. > If a library has more than one module, then how does (use amodule) > know to load the same library as (use bmodule)? It doesn't. These will try to load different libraries. If you have two modules in the same library, you can't use "use"; you have to use "require-library" and "import" separately. > Do modules have to be named after libraries? No, but "use" relies on it. > What's the difference between a module inline in your code and > a library? Nothing, except that you can't import an inline module with "use", only with "import". In R7RS mode, the rules are different: "import" does what native Chicken "use" does, and module names are lists of symbols that are converted into library names thus: module (foo bar baz) corresponds to library "foo.bar.baz". -- John Cowan http://www.ccil.org/~cowan [email protected] You know, you haven't stopped talking since I came here. You must have been vaccinated with a phonograph needle. --Rufus T. Firefly _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
