[Bese-devel] Re: the limitations of the code within actions

Matthew Danish mdanish at andrew.cmu.edu
Sat Feb 4 07:18:53 UTC 2006


On Fri, Feb 03, 2006 at 10:52:40AM +0100, Marco Baringer wrote:
> Matthew Danish wrote:
> > Well this is basically what I did, but it did bring up another problem:
> > 
> > I used MULTIPLE-VALUE-CALL to invoke an outside normal function which
> > handled the errors and returned values indicating what happened.  What
> > it returned, however, was not what I expected:
> > 
> >                 (multiple-value-call
> > 		      (lambda (cc result msg)
> > 
> > What I found was that the first value returned was some kind of Arnesi
> > data structure named CLOSURE, rather than my result.  I inserted the
> > extra parameter cc into the function and now it works fine, but this
> > makes me wonder if there is something better I can do here.
> 
> can you post the actual code? (just the action and the outside function)

Part of a larger LABELS inside DEFACTION:

           (create-guest-password (guest-info)
             (loop for password =
                   (call 'guest-password-form
                         :email (email guest-info))
                   do
                   (multiple-value-call
                       (lambda (cc result msg)
                         (cond ((eql result ':simple-error)
                                (call 'info-message
                                      :ok-text "Go back"
                                      :message msg))
                               ((eql result 't)
                                (return password))))
                     (new-guest-password password guest-info))))




(defun new-guest-password (password guest-info)
  (handler-case (values (set-guest-password
                         password
                         :email (email guest-info))
                        "")
    (invalid-parameters ()
      (values :simple-error "Invalid parameters"))
    (simple-error (e)
      (values :simple-error
              (apply 'format nil
                     (simple-condition-format-control e)
                     (simple-condition-format-arguments e))))))

-- 
;; Matthew Danish -- user: mrd domain: cmu.edu
;; OpenPGP public key: C24B6010 on keyring.debian.org



More information about the bese-devel mailing list