[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Scope problem?
From: |
Matt Gushee |
Subject: |
[Chicken-users] Scope problem? |
Date: |
Sun, 31 May 2009 16:11:27 -0600 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20090213) |
Hi, all--
I am working with the FastCGI egg, and have run into something that has
me really puzzled and a bit worried.
[ BTW, yes, I have ported this egg to Chicken 4.0 for my own use ...
wanted to get going quickly on my web app. But if the original
author(s) is unavailable, or lacks the time or desire to port the
egg, I would be glad to contribute my work to the official
collection--with the understanding that I don't have much expertise
in interfacing w/ C libraries, and I may have accidentally inserted
code that will delete all your files, or send out thousands of
embarrassing e-mails with your signature ]
After installing my modified egg, I attempted to deploy the demo app
from the egg documentation. Basically, it starts an endless loop with
either
(fcgi-external-server-accept-loop ...)
or
(fcgi-dynamic-server-accept-loop ...)
... where 'external' means your app is executed independently of the Web
server, while 'dynamic' means it is executed by the Web server. Anyway,
when invoking either of these functions you pass a request-handler
callback. The callback is itself a HOF with 4 required parameters,
(in out err env). In, out, and err should be self-explanatory; env gives
access to environment variables, and it may be invoked as: (env
VARNAME), which returns the value of 1 variable, (env VARNAME DEFAULT)--
like the previous but with a default value, and (env), which should
return all environment variables as an assoc list.
Anyway, the demo app is supposed to display the results of (env
"SERVER_NAME" "[unknown]") followed by the results of (env). I found
that the first form worked, but the second (reading all environment
variables) did not.
[ omitting lots of unsuccessful code edits and config file tweaks ]
Eventually I saw a stack trace saying "unbound variable: string-length"
Okay, so we needed the srfi-13 module? Yes, but here's what's strange:
* No function or variable from srfi-13 is used in the demo app itself.
* SRFI-13 functions are used within the fastcgi module -- but I already
had (import srfi-13) in that scope.
* When I added (require-extension srfi-13) TO THE APP, it started
working.
Maybe there's just some key point about the Chicken module system that I
don't understand, but this seems like very wrong behavior.
BTW, I am running Chicken SVN rev. 14767 on Linux.
So, do I need further education, or should I report a bug?
--
Matt Gushee
: Bantam - lightweight file manager : matt.gushee.net/software/bantam/ :
: RASCL's A Simple Configuration Language : matt.gushee.net/rascl/ :
- [Chicken-users] Scope problem?,
Matt Gushee <=