[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question on multi-statement "Applying"
Consider two simple CGI scripts:
(begin
(display "Content-type: text/html")
(newline)
(newline)
(display "<HTML><HEAD>")
(display "<TITLE>Declarative Test</TITLE>")
(display "<BODY><H1>Test Using the (begin ...) form</H1>")
(display "This works well. Blah blah blah.!")
(display "<B>")
(newline)
(display "Did I work?")
(display "</HTML>"))
- And -
(display "Content-type: text/html")
(newline)
(newline)
(display "<HTML><HEAD>")
(display "<TITLE>Test</TITLE>")
(display "<BODY><H1>Test of a plain text format</H1>")
(display "This doesn't work so well. Blah blah blah.!")
(display "<B>")
(newline)
(display "Did I work?")
(display "</HTML>"))
Using the first test, I can get complete rendering of an HTML
page in AOLserver.
Using the second test, I only evaluate the first form
(display "Context-type: text/html").
I'm evaluating both cases using "scheme_eval_string_all",
which it seems should treat both the same way. Am I
missing the point of the "_all" variant of eval string?
Neither case works under "scheme_eval_string" (or more
precisely, only the first expression of each string is
evaluated). I would expect test 2 to work this way, but
test 1 should just be a single evaluation, shouldn't it?
Aside: Although the documentation for "scheme_eval_string_all"
says that "if 'all' is not 0, then expressions are read and
evaluated from str until the end of the string is reached."
But according to the code and my experimentation, it really
only reads and evaluates multiple expressions if 'all' is
less than zero. 0 or greater acts like zero.
So, what is the proper behavior? If I send these two scripts
through MzScheme's REPL, (using mzscheme -f test.ss) each
form is evaluated in turn. This seems like the more
intuitive behavior.
What do the rest of you think?
Thanks,
-Brent