[plt-scheme] "appending" to classes rather than extending

From: Jakub Piotr Cłapa (jpc-ml at zenburn.net)
Date: Wed Mar 5 22:56:56 EST 2008

YC wrote:
>  > ** What I'm actually working on is a web app library, where the
>  > implementations of the functions in the library depend on a runtime
>  > value (i.e., the web server request). So, e.g., current-user might be
>  > a function in the library, and it *won't* require a request as an
>  > argument -- it's "built-in" dynamically.  I also want clients of the
>  > library to be able to override any of the default implementations of
>  > the library functions.  This library, btw, is my attempt at striking a
>  > balance in the library vs framework war.
> 
> I have attempted to do similar things (if I read your email correctly) 
> and my approach involves uses of parameters.  The parameters contain a 
> set of default implementations, and users can override them as 
> necessary.  Not sure if that'll match your needs, though.

I guess that parameters can be used to make thread-safe global 
variables. In this way you could set some parameters when you receive 
the HTTP request and write your functions refering to them as you would 
to instance variables. It's like a brand new object for every thread 
(and as far as I understand this is what you need).

-- 
regards,
Jakub Piotr Cłapa


Posted on the users mailing list.