Improving docs
svn: r12316
This commit is contained in:
parent
c129307cd4
commit
f33a5dbf26
|
@ -177,7 +177,7 @@ provides the unit that actually implements a dispatching server.
|
||||||
@(require (for-label web-server/private/closure)
|
@(require (for-label web-server/private/closure)
|
||||||
(for-label web-server/private/define-closure))
|
(for-label web-server/private/define-closure))
|
||||||
|
|
||||||
@defmodule[web-server/private/closure]
|
@defmodule[web-server/private/closure]{
|
||||||
|
|
||||||
The defunctionalization process of the Web Language (see @secref["lang"])
|
The defunctionalization process of the Web Language (see @secref["lang"])
|
||||||
requires an explicit representation of closures that is serializable.
|
requires an explicit representation of closures that is serializable.
|
||||||
|
@ -196,22 +196,50 @@ requires an explicit representation of closures that is serializable.
|
||||||
|
|
||||||
@defproc[(closure->deserialize-name [c closure?])
|
@defproc[(closure->deserialize-name [c closure?])
|
||||||
symbol?]{
|
symbol?]{
|
||||||
Extracts the unique tag of a closure @scheme[c]
|
Extracts the unique tag of a closure @scheme[c].
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
These are difficult to use directly, so @filepath{private/define-closure.ss}
|
These are difficult to use directly, so @filepath{private/define-closure.ss}
|
||||||
defines a helper form:
|
defines a helper form:
|
||||||
|
|
||||||
@subsection[#:style 'hidden]{Define Closure}
|
@subsection[#:style 'hidden]{Define Closure}
|
||||||
@defmodule[web-server/private/define-closure]
|
@defmodule[web-server/private/define-closure]{
|
||||||
|
|
||||||
@defform[(define-closure tag formals (free-vars ...) body)]{
|
@defform[(define-closure tag formals (free-vars ...) body)]{
|
||||||
Defines a closure, constructed with @scheme[make-tag] that accepts
|
Defines a closure, constructed with @scheme[make-tag] that accepts closure that returns
|
||||||
@scheme[freevars ...], that when invoked with @scheme[formals]
|
@scheme[freevars ...], that when invoked with @scheme[formals]
|
||||||
executes @scheme[body].
|
executes @scheme[body].
|
||||||
}
|
}
|
||||||
|
|
||||||
@; XXX Example
|
Here is an example:
|
||||||
|
@schememod[
|
||||||
|
scheme
|
||||||
|
(require scheme/serialize)
|
||||||
|
|
||||||
|
(define-closure foo (a b) (x y)
|
||||||
|
(+ (- a b)
|
||||||
|
(* x y)))
|
||||||
|
|
||||||
|
(define f12 (make-foo (lambda () (values 1 2))))
|
||||||
|
(serialize f12)
|
||||||
|
#,(schemeresult '((1) 1 (('page . foo:deserialize-info)) 0 () () (0 1 2)))
|
||||||
|
(f12 6 7)
|
||||||
|
#,(schemeresult 1)
|
||||||
|
(f12 9 1)
|
||||||
|
#,(schemeresult 10)
|
||||||
|
|
||||||
|
(define f45 (make-foo (lambda () (values 4 5))))
|
||||||
|
(serialize f45)
|
||||||
|
#,(schemeresult '((1) 1 (('page . foo:deserialize-info)) 0 () () (0 4 5)))
|
||||||
|
(f45 1 2)
|
||||||
|
#,(schemeresult 19)
|
||||||
|
(f45 8 8)
|
||||||
|
#,(schemeresult 20)
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@; ------------------------------------------------------------
|
@; ------------------------------------------------------------
|
||||||
@section[#:tag "cache-table.ss"]{Cache Table}
|
@section[#:tag "cache-table.ss"]{Cache Table}
|
||||||
|
|
|
@ -97,8 +97,6 @@ dispatcher. See @filepath{run.ss} for an example of such a script.
|
||||||
The @scheme[#:tcp@] keyword is provided for building an SSL server. See @secref["faq:https"].
|
The @scheme[#:tcp@] keyword is provided for building an SSL server. See @secref["faq:https"].
|
||||||
}
|
}
|
||||||
|
|
||||||
@; XXX Not the right `server' above.
|
|
||||||
|
|
||||||
Here's an example of a simple web server that serves files
|
Here's an example of a simple web server that serves files
|
||||||
from a given path:
|
from a given path:
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,11 @@
|
||||||
|
|
||||||
(define web-server "Web Server")
|
(define web-server "Web Server")
|
||||||
|
|
||||||
; XXX Format better
|
|
||||||
(define (warning . x)
|
(define (warning . x)
|
||||||
(apply elem (bold "Warning: ") x))
|
(apply elem (bold "Warning: ") x))
|
||||||
|
|
||||||
; XXX Actually display link
|
|
||||||
(define (href-link url label)
|
(define (href-link url label)
|
||||||
(elem label " (" url ")"))
|
(link url label))
|
||||||
|
|
||||||
(provide (all-from-out scribble/manual)
|
(provide (all-from-out scribble/manual)
|
||||||
(all-from-out scribble/eval)
|
(all-from-out scribble/eval)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user