Variable *k-id* The id of the running continuation.
(let ((counter 0)) (defun fresh-k-id (method-name form-name) (princ-to-string (incf counter))))
Function get-accessible-wethods Gets all the wethods that are named by a symbol that is accessible in the current package.
Macro defwethod Defines a wethod that allows the special forms `read-form' and `render' in the body.
(def/rkr/macro %read-form-macro (name &key template &rest args) "Fancy macro to output a form, and then return to the current continuation of the wethod when user submits the form." (let ((k (gensym "k")) (k-id (gensym "k-id")) ;; This form depends on the fact that form-name is not a keyword. (form-name (car args)) (form-args (cdr args)) #+(or)(form (gensym "form")) ) `(let/cc ,k (let ((,k-id (fresh-k-id ',name ,form-name))) ;; ,(when template ;; ;; how expensive is it to create call/cc closures? ;; ;; TODO memoizing actually must occur at runtime. ;; `(save-read-form-template-fn ,k-id ;; ;; note this closure would capture variables. ;; (fn (this-form-html-string) ;; (symbol-macrolet ((this-form (html (:noescape this-form-html-string)))) ;; (html ,template))))) (render-form ,k-id ,k ,(if template `(no-call/cc (fn (this-form-html-string) (symbol-macrolet ((this-form (html (:noescape this-form-html-string)))) (html ,template)))) nil) ,form-name ,@form-args) (return-from ,name t)))))