fukamachi / ningle

Super micro framework for Common Lisp
http://8arrow.org/ningle/
273 stars 25 forks source link

Add support for delayed responses. #14

Closed mtstickney closed 8 years ago

mtstickney commented 8 years ago

Following Lack's interface, if the result is a function, we'll use Lack's delayed-response mechanism to handle the response from the handler (applying the same processing as an immediate response when it eventually shows up).

The basic approach here is to:

  1. Make the context a lexical variable that is closed over by the delayed-response lambdas.
  2. Use a macro to establish the special bindings from the lexical context, so that we can recreate the right specials in the callback.
  3. If the result is a function, return a callback that will set up the context, then collect a result, process it, and pass it back to the toplevel responder callback.