Re: [racket-dev] #:namespace
It sounds like one could work around this by taking whatever was passed to #:namespace and making the servlets move over to that namespace, at least. Robby On Mon, Oct 4, 2010 at 8:28 AM, Jay McCarthy jay.mccar...@gmail.com wrote: I didn't realize the handin server used it when I removed it. It definitely doesn't need it. The #:namespace argument made it so the closure given as the request handler was called in a different namespace than it was evaluated in, causing a reinstantiation of the module and other weirdness. For example, #lang web-server/insta (require (only-in some-stateful-module.rkt set-a! unbox-a)) ; where a defaults to Hello World (set-a! Hello World, not) (define (start req) (unbox-a)) would evaluate to Hello World instead of Hello World, not, because some-stateful-module was not shared with the new namespace. This seems incredibly wrong, so I removed the namespace argument and the request handler closure is simply evaluated in the namespace it came from. The #:namespace argument is still useful for other servlets that come from serve/servlet, because they are loaded from disk and may need to share some modules with the main one, but should otherwise be isolated. Jay On Mon, Oct 4, 2010 at 5:56 AM, Matthew Flatt mfl...@cs.utah.edu wrote: Probably there was some mail on this topic, but... Why did `dispatch/servlet' lose its `#:namespace' argument? The handin server was using that argument, so it no longer runs. -- Jay McCarthy j...@cs.byu.edu Assistant Professor / Brigham Young University http://teammccarthy.org/jay The glory of God is Intelligence - DC 93 _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] #:namespace
That's not how the #:namespace argument ever worked. #:namespace takes a list of module names that are shared between the server and the servlets. In the case of the command-line tool, this is effectively a way to make some modules shared between different servlets, through the common party of the server. Since those servlet modules haven't been run, there's no confusing because they've always been evaluated in the same namespace. In contrast, web-server/insta, serve/servlet, and dispatch/servlet all take a closure rather than a module name as the servlet. This closure must have come from some namespace and it causes weird, unexpected behavior to not allow it to use the same namespace it came from when it runs. Basically, the addition of the #:namespace argument in the first place was just a knee-jerk reaction on my part making dispatch/servlet do everything that dispatch-servlets does without really thinking through whether it needed/made sense to have each feature. Jay On Mon, Oct 4, 2010 at 7:41 AM, Robby Findler ro...@eecs.northwestern.edu wrote: It sounds like one could work around this by taking whatever was passed to #:namespace and making the servlets move over to that namespace, at least. Robby On Mon, Oct 4, 2010 at 8:28 AM, Jay McCarthy jay.mccar...@gmail.com wrote: I didn't realize the handin server used it when I removed it. It definitely doesn't need it. The #:namespace argument made it so the closure given as the request handler was called in a different namespace than it was evaluated in, causing a reinstantiation of the module and other weirdness. For example, #lang web-server/insta (require (only-in some-stateful-module.rkt set-a! unbox-a)) ; where a defaults to Hello World (set-a! Hello World, not) (define (start req) (unbox-a)) would evaluate to Hello World instead of Hello World, not, because some-stateful-module was not shared with the new namespace. This seems incredibly wrong, so I removed the namespace argument and the request handler closure is simply evaluated in the namespace it came from. The #:namespace argument is still useful for other servlets that come from serve/servlet, because they are loaded from disk and may need to share some modules with the main one, but should otherwise be isolated. Jay On Mon, Oct 4, 2010 at 5:56 AM, Matthew Flatt mfl...@cs.utah.edu wrote: Probably there was some mail on this topic, but... Why did `dispatch/servlet' lose its `#:namespace' argument? The handin server was using that argument, so it no longer runs. -- Jay McCarthy j...@cs.byu.edu Assistant Professor / Brigham Young University http://teammccarthy.org/jay The glory of God is Intelligence - DC 93 _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev -- Jay McCarthy j...@cs.byu.edu Assistant Professor / Brigham Young University http://teammccarthy.org/jay The glory of God is Intelligence - DC 93 _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] #:namespace
I didn't realize the handin server used it when I removed it. It definitely doesn't need it. The #:namespace argument made it so the closure given as the request handler was called in a different namespace than it was evaluated in, causing a reinstantiation of the module and other weirdness. For example, #lang web-server/insta (require (only-in some-stateful-module.rkt set-a! unbox-a)) ; where a defaults to Hello World (set-a! Hello World, not) (define (start req) (unbox-a)) would evaluate to Hello World instead of Hello World, not, because some-stateful-module was not shared with the new namespace. This seems incredibly wrong, so I removed the namespace argument and the request handler closure is simply evaluated in the namespace it came from. The #:namespace argument is still useful for other servlets that come from serve/servlet, because they are loaded from disk and may need to share some modules with the main one, but should otherwise be isolated. Jay On Mon, Oct 4, 2010 at 5:56 AM, Matthew Flatt mfl...@cs.utah.edu wrote: Probably there was some mail on this topic, but... Why did `dispatch/servlet' lose its `#:namespace' argument? The handin server was using that argument, so it no longer runs. -- Jay McCarthy j...@cs.byu.edu Assistant Professor / Brigham Young University http://teammccarthy.org/jay The glory of God is Intelligence - DC 93 _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] #:namespace
On Mon, Oct 4, 2010 at 8:17 AM, Eli Barzilay e...@barzilay.org wrote: 40 minutes ago, Jay McCarthy wrote: [...] I removed the namespace argument and the request handler closure is simply evaluated in the namespace it came from. The relevant piece of code: #lang racket/base (require ... handin-server/private/logger ...) (provide run) (define (run) ... (run-servlet dispatcher #:namespace '(... handin-server/private/logger ...) #:log-file (get-conf 'web-log-file)) ...) does the above mean that the logger will be shared because there is no new instantiation of this code? Yup Jay -- Jay McCarthy j...@cs.byu.edu Assistant Professor / Brigham Young University http://teammccarthy.org/jay The glory of God is Intelligence - DC 93 _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev