[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Modules and environments
From: |
Peter Bex |
Subject: |
Re: [Chicken-users] Modules and environments |
Date: |
Sun, 30 Aug 2009 19:48:36 +0200 |
User-agent: |
Mutt/1.4.2.3i |
On Sun, Aug 30, 2009 at 10:27:26AM -0700, Kon Lovett wrote:
> The "environments" extension is tolerated but not
> endorsed. As an example, the "apropos" extension does not use the
> "environments" extension but instead relies on undocumented calls.
That's a good sign that something's wrong. If the apropos egg did not
exist and I would have to write it, I'd start by using the environments
egg. If that doesn't work, I'd consider the environments egg broken.
> I suggest re-opening the debate.
Consider it re-opened ;)
I'm trying to make an URI dispatcher which is based on the new
uri-dispatch egg. This egg uses the environments egg to obtain
bindings to procedures after checking in a whitelist if the procedure
is allowed to be called.
In order not to pollute the webserver's environment, I put some helper
functions inside a module, which exports only the procedure that is in
the whitelist.
It looks like this:
(module foo
(foo-proc)
(define helper ...)
(define another-helper ...)
;; much more helpers here
(define (foo-proc . args)
(helper ...))
)
(import foo)
(whitelist! 'foo)
This way, I can have several other web pages on which perhaps the same
helper names are used without causing name clashes (which is exactly
what modules were invented for).
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth
pgpazB6TK2zYq.pgp
Description: PGP signature
- [Chicken-users] Modules and environments, Peter Bex, 2009/08/30
- Re: [Chicken-users] Modules and environments, Thomas Chust, 2009/08/30
- Re: [Chicken-users] Modules and environments, Peter Bex, 2009/08/30
- Re: [Chicken-users] Modules and environments, Thomas Chust, 2009/08/30
- Re: [Chicken-users] Modules and environments, Peter Bex, 2009/08/30
- Re: [Chicken-users] Modules and environments, Thomas Chust, 2009/08/30
- Re: [Chicken-users] Modules and environments, Peter Bex, 2009/08/30
- Re: [Chicken-users] Modules and environments, Thomas Chust, 2009/08/30
- Re: [Chicken-users] Modules and environments, Peter Bex, 2009/08/30
- Re: [Chicken-users] Modules and environments, Kon Lovett, 2009/08/30
- Re: [Chicken-users] Modules and environments,
Peter Bex <=
- [Chicken-users] Re: Modules and environments, felix, 2009/08/31