Hi Brian, I think you are misunderstanding what that section is about. It is just describing how the system is implemented. There's basically nothing in there that you need to know as user other than "It may take a while to compile." For instance, you don't worry about the fact that all tree-like functions in your normal Racket code are eventually turned into linear sequences of assembly. Those changes to your code discussed in 3.2 are things that happen in the compiler, you don't need to do anything, just like you don't need to think about register allocation when you write normal programs, but it happens behind the scenes.
Nothing described in section 3 happens to your code unless you write in `#lang web-server` or `#lang web-server/base`. You can use or not use continuations and use or not use this library... they are totally orthogonal. There is basically no program that you can write in one that you can't write in the other, as long as you call the appropriate version of `send/suspend`. The whole point of this library is to write code as-if it were stateful, but the compiler automatically makes it stateless. If you are comfortable programming directly with inverted control, then go right ahead and implement the stateless stuff yourself. Both ways are going to be equally efficient, although the `#lang web-server` library will be guaranteed to do it correctly and make it easy to do stuff like encrypt and sign the state you store on the clients. As far as using `serve/servlet` or not, the implementation of it is really simple  in case you want to adapt it. I don't recommend using the lift dispatcher directly. You probably want to use `dispatch/servlet`. Remember, in Racket, a servlet is just a function from request to response, with some resource control. It doesn't impose any programming style or other costs on you. I get the impression from your comments that you are really nervous about some sort of costs imposed by using Racket libraries and think you will get some benefit by being "low-level". This is probably misguided and just based on some misunderstandings. Jay 1. https://github.com/racket/web-server/blob/master/web-server-lib/web-server/servlet-env.rkt#L156 On Fri, Nov 30, 2018 at 4:30 PM Brian Adkins <lojicdot...@gmail.com> wrote: > > I could be misreading the information in "3.2 Usage Considerations", but it > seemed like the modifications to my program were automatic, but maybe that > only happens when using #lang web-server or #lang web-server/base ? > > Regardless, I'm wondering if maybe I should just use (serve) instead of > (serve/servlet) since I'll likely be working at that level later anyway. In > that case, it looks like dispatch-lift:make is the main thing I need to get > things rolling. As a simple example: > > #lang racket > (require web-server/web-server) > (require web-server/http/response-structs) > (require (prefix-in log: web-server/dispatchers/dispatch-log)) > (require (prefix-in lift: web-server/dispatchers/dispatch-lift)) > (require (prefix-in seq: web-server/dispatchers/dispatch-sequencer)) > (require (prefix-in stat: web-server/dispatchers/dispatch-stat)) > > (define (controller request) > (response > 200 > #"OK" > (current-seconds) > TEXT/HTML-MIME-TYPE > empty > (λ (op) (write-bytes #"<html><body>Hello, World!</body></html>" op)))) > > (serve > #:dispatch (seq:make (log:make #:format log:extended-format > #:log-path "development.log") ; log request > (stat:make) ; print memory usage > (lift:make controller)) > #:port 8080) > > To be clear, it's not just continuations that I want to avoid, I'd also like > to avoid the changes that are described in section 3.2 above. > > > On Friday, November 30, 2018 at 3:20:39 PM UTC-5, Jay McCarthy wrote: >> >> There's nothing wrong with ignoring the continuation support in the >> Web server, either the native ones or stateless ones. If you do, I >> recommend using something like `create-none-manager`  as the >> `#:manager` argument to `serve/servlet` so that you don't accidentally >> start using them. The "too far" line is that you can't use >> `send/suspend`. In the web-server/servlet/web  module, you just >> want to use `send/back` and `with-errors-to-browser`, and no other >> functions. >> >> Jay >> >> 1. >> https://docs.racket-lang.org/web-server/servlet.html?q=none-manager#%28def._%28%28lib._web-server%2Fmanagers%2Fnone..rkt%29._create-none-manager%29%29 >> 2. >> https://docs.racket-lang.org/web-server/servlet.html?q=send%2Fsuspend#%28part._web%29 >> On Fri, Nov 30, 2018 at 2:17 PM Brian Adkins <lojic...@gmail.com> wrote: >> > >> > A while ago, I read Jay's response about how to use the Racket web server >> > w/o continuations here: >> > >> > https://groups.google.com/forum/#!msg/racket-users/bTBj-RbMLDA/k80HNazuFAAJ >> > >> > At the time, I didn't dig very deeply into it and just assumed avoiding >> > web-server/servlet would be sufficient, but I just read through the >> > documentation on stateless servlets here: >> > >> > https://docs.racket-lang.org/web-server/stateless.html >> > >> > In particular, section 3.2, where it states things like: >> > >> > "All uses of letrec are removed and replaced with equivalent uses of let >> > and imperative features." >> > >> > "The program is defunctionalized with a serializable data-structure for >> > each lambda" >> > >> > "First, this process drastically changes the structure of your program. It >> > will create an immense number of lambdas and structures your program did >> > not normally contain. The performance implication of this has not been >> > studied with Racket." >> > >> > It seems like there is quite a bit of stuff going on to support >> > continuations with stateless servlets. Since I'm not planning on using >> > continuations at all, I'm not sure I want the changes to my code described >> > in section 3.2. >> > >> > I'm coming from an entirely stateless architecture w/ Ruby/Rails, and I >> > was planning on using a similar style w/ Racket, so I'm just trying to get >> > a feel for how low in the stack I need to be to avoid the extra >> > functionality that I don't want/need. Eventually, I'm planning on resuming >> > work on a web app framework in Racket that steals my favorite things from >> > Rails & other frameworks, and leaves out the cruft. For that, I expect >> > I'll need to base my code on lower levels, but for my current app, I don't >> > have time to create too much infrastructure, so I'd like to leverage basic >> > things from built-in Racket functionality without going "too far", and I'm >> > not even able to articulate well where the "too far" line is. >> > >> > Thanks, >> > Brian >> > >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "Racket Users" group. >> > To unsubscribe from this group and stop receiving emails from it, send an >> > email to racket-users...@googlegroups.com. >> > For more options, visit https://groups.google.com/d/optout. >> >> >> >> -- >> -=[ Jay McCarthy http://jeapostrophe.github.io ]=- >> -=[ Associate Professor PLT @ CS @ UMass Lowell ]=- >> -=[ Moses 1:33: And worlds without number have I created; ]=- > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- -=[ Jay McCarthy http://jeapostrophe.github.io ]=- -=[ Associate Professor PLT @ CS @ UMass Lowell ]=- -=[ Moses 1:33: And worlds without number have I created; ]=- -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.