Testing for Pre-existing symbols in a context
Posted: Fri Mar 07, 2008 3:00 am
				
				Example:
I have written my own cgi context. It has a number of control
variables (think symbols)
I want to - if necessary customize those symbols on startup.
I have a context method call 'on.
Inside of the 'on method, a helper function called 'parse-args
intercepts args and processes them two at a time as follows:
As written, I may mistakenly submit a symbol that is not predefined
in the context. I would like to be able to test whether that symbol
is already defined and throw an error if not. I like error messages!
I'd welcome some suggestions on how to proceed.
Thanks
Tim
			I have written my own cgi context. It has a number of control
variables (think symbols)
I want to - if necessary customize those symbols on startup.
I have a context method call 'on.
Code: Select all
;; Intialize the CGI object
(cgi:on 'cs nil 'placeholder true) ;; assumes that 'cs and 'placholder
                                              ;; are already defined
intercepts args and processes them two at a time as follows:
Code: Select all
(define (parse-args)
 (let((key)(val))
   (dolist (item (explode (args)))
		   (set 'key (last(parse(string(first(first item)))":")))
		   (set 'val(second(first item)))
		   (set (sym key) val))) ;; reset the symbol
 )in the context. I would like to be able to test whether that symbol
is already defined and throw an error if not. I like error messages!
I'd welcome some suggestions on how to proceed.
Thanks
Tim