chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] When to use use and when to require-extension?


From: Christian Kellermann
Subject: [Chicken-users] When to use use and when to require-extension?
Date: Fri, 23 Oct 2009 11:05:31 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hi,

while doing some more testing on the sdl egg, I came across this
peculiarity.  The sdl egg defines a sdl-csi program, that works as
a repl and initialises sdl first. The script is really short and
looks like this:

(import chicken scheme foreign)

(declare
 (foreign-declare "#include <SDL.h>\n")
 (run-time-macros)
)
(foreign-code "SDL_Init(SDL_INIT_EVERYTHING);")

(use posix)
(use sdl)

(handle-exceptions
    exn
    exn
  (load (string-append (or (getenv "HOME") ".") "/.csirc")))

(for-each load (cdr (argv)))

(repl)

(sdl-quit)
(exit 0)

Now, consider a file like this, called foo.scm:

(use apropos)
(print "SDL things I know about: ~A~%" (apropos 'sdl))


Now when I load it with 'sdl-csi foo.scm'  I get an error like this:
Error: unbound variable: apropos

If I change 'use' to 'require-extension' it works as expected.

As I found out the '(use)' statement is an er-transformer that
obviously cannot be invoked in (repl).  I don't see the csi program
in core doing something else. So why does (use) work there?

Thanks,

Christian




reply via email to

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