[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] hygienic chicken and load/link/import forms

From: felix winkelmann
Subject: [Chicken-users] hygienic chicken and load/link/import forms
Date: Fri, 13 Jun 2008 09:05:31 +0200


As Peter has suggested, it is probably a good idea to rethink the whole
require/import stuff in the face of having modules.

Here is a list of requirements:

- code in modules only has access to other modules, from which one can
  import, so all extensions will have to be turned into modules.
- "import" is required, of course. It loads import-libraries at compile-time
   (and so may replace any needs for "require-for-syntax" and/or
  the "syntax"/"require-at-runtime" extension.-properties).
- In the interpreter, run-time code can be loaded with "load". "require"
  is identical to load, but also searches the extension library and
  include path.
- "require-extension" (srfi-55) must, strictly speaking, make the bindings
  in the loaded extensions available, so has to make an implicit "import"
  ("use" should probably go, since it just causes confusion, even though it
  is just an alias for "require-extension").
- in the compiler, the option of static linking must be available, so
  there should be a special form that does the right thing (what
  used to be, but without doing the implicit import), depending on command-line
  options (this should also do the correct thing for core units, and
thus could replace
  "(declare (uses ...))", which doesn't fit in too well).

This is an opportunity to clean up the whole mess a bit. On the other hand,
making it as transparent as possible whether a piece of code is interpreted or
compiler or linked dynamically or statically will be tricky to implement or
require user-annotations. So perhaps we can try to work out a set of basic rules
and special forms that cover all the use cases, and which is as simple
and intuitive as possible.

So, here my suggestions (still unclear - there are so many situations to
take care of):

[syntax] (require-library ID ...)
  Load compiled or source file from extension-library dir, include
path or current
  directory. In the compiler, replace with a "uses" declaration, when
any of the static
  command line options are given.

[syntax] (require-extension ID ...)
  As above, but does an implicit "import".

[procedure] (load FILENAME)
[procedure] (require 'ID)
  As usual. "require" is a procedure and required for implementing
"require-..." anyway.

[syntax] (import SPEC ...)
  As usual.

"require-for-syntax" isn't needed anymore (and can be handled with
eval-when + require).
In fact, I have removed the user-visible part in the current hygeinic HEAD.

Any ideas?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]