1 Running the Web Server
2 Scheme Servlets
3 Web Language Servlets
4 Configuration
5 Dispatchers
6 Web Config Unit
7 Web Server Unit
8 Continuation Managers
9 Internal
10 Troubleshooting
11 Acknowledgements
Index
On this page:
make-closure-definition-syntax
closure->deserialize-name
9.4.1 Define Closure
define-closure
Version: 4.0.2

 

9.4 Serializable Closures

 (require web-server/private/closure)

The defunctionalization process of the Web Language (see Web Language Servlets) requires an explicit representation of closures that is serializable. "private/closure.ss" is this representation. It provides:

(make-closure-definition-syntax

 

tag

 

 

 

 

 

 

fvars

 

 

 

 

 

 

proc)

 

 

syntax?

  tag : syntax?

  fvars : (listof identifier?)

  proc : syntax?

Outputs a syntax object that defines a serializable structure, with tag as the tag, that represents a closure over fvars, that acts a procedure and when invoked calls proc, which is assumed to be syntax of lambda or case-lambda.

(closure->deserialize-name c)  symbol?

  c : closure?

Extracts the unique tag of a closure c

These are difficult to use directly, so "private/define-closure.ss" defines a helper form:

 (require web-server/private/define-closure)

(define-closure tag formals (free-vars ...) body)

Defines a closure, constructed with make-tag that accepts freevars ..., that when invoked with formals executes body.