From: Ken A. <kan...@bb...> - 2004-08-10 21:05:04
|
OK, i like your approach of everyone sharing the same environment. This is what the lisp machine did, though there was typically only one user at a time, though many processes with no user/kernel distinction. You could take down a Lisp Machine by typing (setq current-process nil) Luckily, you could use set! to redefine define. Maybe you can make a game for your students out of this - write your servlet so what people do to the global environment won't bother it. It might motiviate a good discussion about modularity and objects. k At 04:36 PM 8/10/2004 -0400, Timothy John Hickey wrote: >On Aug 10, 2004, at 3:14 PM, Ken Anderson wrote: > >>Tim, >>Your documentation mentions that a init.scm file is loaded the first time a .servlet is executed. >> How should a servlet that needs to load code do it so it only happens once? >One way is to use the (use-module "FILE.scm") command >but we need to make a (reload-module "FILE.scm") command that can be used in development.... > >> >>Also, since all servlets run in the same environment, won't your students potentially have name conflicts, at least potentially? >This is true, but I view it as a feature and not a bug. > >The idea is to have the student's append their initials or login id to all their globally defined names >(e.g. (define (tjh-webpage TITLE CSS BODY) ......) ) >then the students can load each others code and use each other's procedures ... > >We could also have students use the > (use-module "FILE.scm" 'import 'all "PREFIX:") >or (reload-module "FILE.scm" 'import 'all "PREFIX:") >approach to load in their code with a prefix..... This keeps the FILE.scm code simple >and still allows the libraries to be used without much interference... > >This can be used to encourage a community of reuse. Student's in the summer course >thought it was very cool that they could all use everyone else procedures .... > >I do need a way for them to reset the primitives, because last summer someone >wrote a servlet that started with > (set! define 5) >which wiped out the real defintion of define!! > >Another possibility would be to create a global hashtable H of jscheme.JScheme instances >and have a macro that looked up the SchemeEvaluator in which to evaluate the servlet... > >For example, > >(use-context > "tjh" > > (use-module "mydefs.scm" 'import 'all) > ... > (servlet (a b c) > BODY > ) >) > >would lookup the context (a jscheme.JScheme. instance) >with key "tjh" (or create one if it doesn't exist), and then >evaluate the servlet in that context. Does this seem like >a reasonable approach?? > >---Tim--- > > > > > > >> >>k |