Correct. Almost no one needs to worry about this. serve/servlet takes a function, not a module, and so that function runs in the module namespace is came from (which is the same one for the server and probably everything else). serve/servlet effectively bundles your servlet into the server and they share everything.
Servlets only come from modules if they are read from the disk by a running server in response to a request. With serve/servlet, this is if they are in servlets-root. If you use the command-line tool or the "standard dispatcher sequence", then it is much more relevant. I don't recommend using that basically ever. Jay On Fri, Mar 16, 2012 at 8:29 AM, Robby Findler <[email protected]> wrote: > Wait: I don't understand. I do 'racket main.rkt'. That file contains a > call to serve/servlet (with #:stateless? #t) and passes a function > 'start' that gets called with requests. I think that maybe what you're > saying below is that what I'm doing is not "servlets" and what happens > is just what I would expect: there is no fancy monkey business with > namespaces (unless my code does it). > > Is that right? > > Robby > > On Fri, Mar 16, 2012 at 9:22 AM, Jay McCarthy <[email protected]> wrote: >> Servlets do *not* share the same module instantiations. Each is in a >> different unique one. They only shared web-server/http and net/url (so >> that structs can communicate between the server and them.) However, if >> you use serve/servlet, this is irrelevant because you probably are not >> instantiating different servlets anyways. >> >> It is possible to explicitly share any number of modules: >> >> http://docs.racket-lang.org/web-server-internal/dispatch-servlets.html?q=make-servlet-namespace#(mod-path._web-server/configuration/namespace) >> >> and the #:servlet-namespace argument to serve/servlet >> >> As I mentioned above, this is most useful for sharing structs and states. >> >> Jay >> >> On Thu, Mar 15, 2012 at 8:33 PM, Robby Findler >> <[email protected]> wrote: >>> Another question: do all servlets (in a single running server) share >>> the same module instantiations? >>> >>> I ask because I want to store some data that the user of the web >>> server is supplying (on the disk) and I want to be sure that only one >>> thread reads and writes the data. So if all servlets share the same >>> module instantiations, I'm set. But if they don't, then I'm in >>> trouble. >>> >>> Robby >> >> >> >> -- >> Jay McCarthy <[email protected]> >> Assistant Professor / Brigham Young University >> http://faculty.cs.byu.edu/~jay >> >> "The glory of God is Intelligence" - D&C 93 -- Jay McCarthy <[email protected]> Assistant Professor / Brigham Young University http://faculty.cs.byu.edu/~jay "The glory of God is Intelligence" - D&C 93 ____________________ Racket Users list: http://lists.racket-lang.org/users

