cormullion wrote:I think you have to use load after a context switch. The manual has much to say on symbol creation in contexts, some of which might be the issue here: "a context switch should only occur on the top level of a program, never inside a function".
Hmm... I think I was confused by Lutz's use of it here:
Code: Select all
; in CGI:put-page
(context MAIN)
(eval-string (slice page (+ start 2) (- end start 2)))
(context CGI)
But I guess after read that part in the docs it seems to be referring to the idea that any symbols created using (sym) and (load) by eval-string will therefore be created in the MAIN context.
That seems to work, thanks, but it's kind-of annoying in the sense that if you're using a module that doesn't do that you're going to have to make a custom version of it. The reason that this matters is because some modules don't just define things, they also execute code, and sometimes you don't want that code to be executed twice (for example, your CGI.lsp or Jeff's Request.lsp).
Why don't (define) and (set) also create the symbols in the current context..? My approach would work if they did... And sometimes they seem to but they don't in the way I tried to use it. Why is this?